Magnet with S and N poles