1S-3S and 1S-3D doppler-free two-photon transition in hydrogen and deuterium