Gamma-ray spectroscopy of excited states in ¹⁷⁷Hf and ¹⁸²W