Transverse and longitudinal momentum spectra of pions in pd interactions at 3.5 GeV/c