Onset of magnetism in transition-metal monolayers: V and Rh on Ag(001)