{"raw_statement":[{"iden":"problem statement","content":"We have an $N \\times N$ grid. Let $(i,j)$ denote the square at the $i$\\-th row from the top and $j$\\-th column from the left in this grid.  \nFind one way to write an integer on every square to satisfy the conditions below.\n\n*   Each integer between $1$ and $N^2$ is written exactly once.\n*   For every pair of integers $i,j\\, (1 \\leq i,j \\leq N)$, the square $(i,j)$ satisfies the following.\n    *   Among the squares horizontally, vertically, or diagonally adjacent to $(i,j)$ (there are at most eight of them), let $a$ and $b$ be the number of squares with integers larger than and smaller than that of $(i,j)$, respectively. Then, $a \\neq b$ holds.\n\nUnder the Constraints of this problem, it can be proved that such a way to write integers always exists."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 500$\n*   $N$ is an integer."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$"},{"iden":"sample input 1","content":"2"},{"iden":"sample output 1","content":"1 2\n3 4\n\nThis output contains each integer between $1$ and $N^2\\, (=4)$ exactly once, so the first condition is satisfied.  \nAdditionally, among the squares horizontally, vertically, or diagonally adjacent to the square $(1,1)$, three squares $(1,2)$, $(2,1)$, and $(2,2)$ have integers larger than that of $(1,1)$, and none has an integer smaller than that.  \nThus, for $(1,1)$, we have $a=3$ and $b=0$, so $a\\neq b$ holds.  \nSimilarly, it can be verified that $a\\neq b$ also holds for the other squares, so the second condition is satisfied.  \nTherefore, this output is valid."},{"iden":"sample input 2","content":"3"},{"iden":"sample output 2","content":"1 2 3\n5 4 6\n7 8 9"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}