What determines the polarity at the ends of an electromagnet? The