A freely suspended magnet always rest in north-south direction because the north-pole of the magnet lies in the geographic north direction and the south pole of the magnet lies in the geographic south direction. So it aligns itself in N-S direction. As unlike poles attract and like poles repel.