Solution (source code)

= Solution

Use two stored <bits> $(L,G)$ with symmetric meanings:
$$
\boxed{\mathrm{Lt}=10,\qquad\mathrm{Eq}=00,\qquad\mathrm{Gt}=01.}
$$
Swapping the two numbers interchanges $L$ and $G$ and fixes equality. Decode the outputs by
$$
\boxed{x=L,\qquad y=\neg L\land\neg G,\qquad z=G.}
$$
Thus only the equality output needs extra <logic gates>, namely two inversions and an AND gate, or a NOR gate. Code `11` is unused. Initialize both <D flip-flops> to zero before a new pair of numbers so the starting state is `Eq`. In normal operation only the three valid codes are reachable.