Hyperfine structure of HDO and D2O by beam maser spectroscopy