Why a magnet lose magnetism when heated?