|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||1||1||1||100.000%|
Brainy Smurf invented a new ($n \times n$) SmurfBoard which looks just like a normal chessboard except that the left edge is glued to the right edge and the top edge is glued to the bottom edge (don't ask how it's possible, it's patented by Brainy in Smurf Patent Office). As usual, the other Smurfs were not interested in his invention so he went to Papa Smurf:
The SmurfBoard is so fragile that it cannot be rotated or flipped. Brainy being so smart immediately concluded that for $k$ colors there are $k^4$ combinations so he'll need $n = k^2$. But finding desired coloring for any $k$ larger than two is beyond even Brainy's skills. Maybe you can help him?
First and only input line contains $k$ ($k \leq 40$ and $k$ is prime) -- the number of colors to be used. The dimensions of desired SmurfBoard are $n \times n$ where $n = k^2$.
Output $n$ lines with $n$ integers each specifying any correct coloring (colors are numbered from $1$ to $k$). If it is not possible to color the SmurfBoard then on a single line output the word "NO" (without quotes).
1 2 1 1 1 2 2 2 2 2 2 1 1 1 2 1