Solution (source code)

= Solution

Using $A^3=I$, the matrix power reduces modulo three:
$$
\boxed{A^{3n+2}=A^2=\begin{pmatrix}0&0&1\\1&0&0\\0&1&0\end{pmatrix}.}
$$