Research Institute of Given Strings has opened a new department — Research Department of Given Matrices. Similarly to the problem of string canonization, this department is working on the problem of matrix canonization.
Consider a matrix m_{i,j} of size 2^n \times 2^n, containing lowercase Latin letters.
A circular shift of a matrix is a matrix m' such that m'_{i,j} = m_{(i + \Delta i)\bmod 2^n,\ (j + \Delta j)\bmod 2^n} for some and (the rows and columns of the matrix are indexed from to 2^n - 1).
Matrix is lexicographically less than matrix of the same size, if there exist and , such that for all i' < i, or for i' = i and j' < j, p_{i',j'} = q_{i',j'}, and p_{i,j} < q_{i,j}. That is, matrices are compared row by row.
The canonization problem for matrix is to find such a circular shift of that is lexicographically less than or equal to any other circular shift of .
Help the researchers of the new department find the canonical representation of the matrix.
The matrix , of size 2^n \times 2^n (0 \leq n \leq 9).
Output the canonical representation of matrix .
Example 1