Elastic and inelastic deuteron scattering from 152Sm and 162Dy