The relative abundances and energy spectra of solar-flare-accelerated deuterium, tritium, and helium-3