The like poles of different magnets repel each other, and the unlike poles attract each other.
(The like poles of different magnets; repel; each other) (the unlike poles; attract; each other)
The like poles of different magnets the unlike poles
repel attract
each other
each other