There is a $3\times3$ matrix filled by numbers 1~9 that might look like this
$$\begin{bmatrix}3 & 8 & 2 \\ 4 & 1 & 6 \\ 7 & 5 & 9\end{bmatrix}$$
All its rows and columns can be "rolled forwards and backwards" (like permutation acting on a single row/column)
Roll the second column upwards:
$$\begin{bmatrix}3 & 1 & 2 \\ 4 & 5 & 6 \\ 7 & 8 & 9\end{bmatrix}$$
And roll the first row to the left, we get
$$A=\begin{bmatrix}1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9\end{bmatrix}$$
Now, if given an arbitrary matrix like this, how can I tell if it can be restored back to $A$? If it always could, why?