Like poles repel each other while unlike poles attract each other.
A compass is usually a small box with a glass cover on it. A magnetised needle is pivoted inside the box, which can rotate freely.
A compass also has dial with directions marked on it. Often North-South direction is highlighted with different colour.
Magnets lose their properties if they are heated, hammered or dropped from some height.
To keep them safe, magnets should be kept in pairs with their unlike poles on same side and separated by a piece of wood while two soft pieces of soft iron are placed across their ends.
Keep magnets away from cassettes, mobiles, television, music system, compact disks (CDs) and the computer