Fix printDihedrals for reverse-order masks and simplify logic.