How do GPS satellites know where they are?

Our Global Positioning System (GPS) tells us exactly where we are, down to a few metres, but how do satellites that make up the GPS themselves know where they are?