Solution (source code)

= Solution

Use three <controlled-NOT gate>[controlled-NOT gates] with control-target directions
$$
1\longrightarrow2,
\qquad
2\longrightarrow1,
\qquad
1\longrightarrow2.
$$
On computational-basis bits they act as
$$
(x,y)\longmapsto(x,x\oplus y)
\longmapsto(y,x\oplus y)
\longmapsto(y,x).
$$
They therefore implement the <Three-CNOT decomposition of the SWAP gate>, and linearity proves the identity on every two-qubit state.