Magnetic dipole spin excitations in rare-earth and actinide nuclei