A simple bar magnet has two ends where its pull is strongest: a north pole (N) and a south pole (S). On the bench the N half of each bar is red and the S half is blue.
The rule is short: like poles repel, unlike poles attract. N pushes N away, S pushes S away, and N and S pull together. Try it before reading on.