I came up with this problem when I'm randomly playing around with my poker cards: first, arrange the cards $1$ to $9$ in a $3 \times 3$ grid:
$$ \begin{array}{|c|c|c|} \hline 1 & 2 & 3 \\ \hline 4 & 5 & 6 \\ \hline 7 & 8 & 9 \\ \hline \end{array} $$
then, rotate the rows and columns, i.e., a row $ \begin{array}{|c|c|c|} \hline 1 & 2 & 3 \\ \hline \end{array} $ may become $ \begin{array}{|c|c|c|} \hline 2 & 3 & 1 \\ \hline \end{array} $ (left-rotate) or $ \begin{array}{|c|c|c|} \hline 3 & 1 & 2 \\ \hline \end{array} $ (right-rotate), and similarly for columns (up-rotate or down-rotate).
The question: given an unlimited amount of row- and column-rotations, is it possible to transform the given state into the following state? (i.e., swap the $8$ and $9$ without changing the other cards)
$$ \begin{array}{|c|c|c|} \hline 1 & 2 & 3 \\ \hline 4 & 5 & 6 \\ \hline 7 & 9 & 8 \\ \hline \end{array} $$
I have been playing with the cards, without success. I get pretty close, but I can't produce the exact state. I am starting to suspect this is impossible. But I am unsure how to prove it.
I try to divide the $3 \times 3$ grid into three areas $A, B, C$:
$$ \begin{array}{|c|c|c|} \hline A & B & C \\ \hline B & C & A \\ \hline C & A & B \\ \hline \end{array} $$
and somehow come up with an invariant. However, I have no idea how to proceed.
Each rotation of a row or column is an even permutation. The product of even permutations is again an even permutation. Swapping $8$ and $9$ is an odd permutation. Thus you can’t reach it by performing such rotations.