Magnet
Rare earth (lanthanoid) elements have a partially occupied "f" electron shell (which can accommodate up to 14 electrons). The spin of these electrons can be aligned, resulting in very strong magnetic fields, and therefore, these elements are used in compact high-strength magnets where their higher price is not a concern. The most common types of rare-earth magnets are samarium-cobalt and neodymium-iron-boron (NIB) magnets.
Magnet
Ancient people learned about magnetism from lodestones (or magnetite) are naturally magnetized pieces of iron ore. The word "magnet" was adopted in Middle English from Latin "magnetum" "lodestone", ultimately from Greek ("magnētis [lithos]") meaning "[stone] from Magnesia", a part of ancient Greece where lodestones were found. Lodestones, suspended so they could turn, were the first magnetic compasses. The earliest known surviving descriptions of magnets and their properties are from Greece, India, and China around 2500 years ago. The properties of lodestones and their affinity for iron were written of by Pliny the Elder in his encyclopedia "Naturalis Historia".