Let $$\pi = \begin{pmatrix} 1 & 2 & 3 \\ 3 & 1 & 2 \\ \end{pmatrix}$$ be a permutation so that $$\pi^p = \underbrace{\pi \pi \ldots \pi}_{p \text{ times}} = \begin{pmatrix} 1 & 2 & 3 \\ 1 & 2 & 3 \\ \end{pmatrix}$$ How do you find $p$ where $p$ is a natural number different from $0$?
I tried solving this problem by multiplying the permutation by itself a bunch of times until i got the right answer but that just doesn't seem like the smartest way of solving it , there must be another way.