{"problem":{"name":"Loong and Takahashi","description":{"content":"There is a grid with $N$ rows and $N$ columns, where $N$ is an odd number at most $45$. Let $(i,j)$ denote the cell at the $i$\\-th row from the top and $j$\\-th column from the left. In this grid, you ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc335_d"},"statements":[{"statement_type":"Markdown","content":"There is a grid with $N$ rows and $N$ columns, where $N$ is an odd number at most $45$.\nLet $(i,j)$ denote the cell at the $i$\\-th row from the top and $j$\\-th column from the left.\nIn this grid, you will place Takahashi and a dragon consisting of $N^2-1$ parts numbered $1$ to $N^2-1$ in such a way that satisfies the following conditions:\n\n*   Takahashi must be placed at the center of the grid, that is, in cell $(\\frac{N+1}{2},\\frac{N+1}{2})$.\n*   Except for the cell where Takahashi is, exactly one dragon part must be placed in each cell.\n*   For every integer $x$ satisfying $2 \\leq x \\leq N^2-1$, the dragon part $x$ must be placed in a cell adjacent by an edge to the cell containing part $x-1$.\n    *   Cells $(i,j)$ and $(k,l)$ are said to be adjacent by an edge if and only if $|i-k|+|j-l|=1$.\n\nPrint one way to arrange the parts to satisfy the conditions. It is guaranteed that there is at least one arrangement that satisfies the conditions.\n\n## Constraints\n\n*   $3 \\leq N \\leq 45$\n*   $N$ is odd.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc335_d","tags":[],"sample_group":[["5","1 2 3 4 5\n16 17 18 19 6\n15 24 T 20 7\n14 23 22 21 8\n13 12 11 10 9\n\nThe following output also satisfies all the conditions and is correct.\n\n9 10 11 14 15\n8 7 12 13 16\n5 6 T 18 17\n4 3 24 19 20 \n1 2 23 22 21\n\nOn the other hand, the following outputs are incorrect for the reasons given.\nTakahashi is not at the center.\n\n1 2 3 4 5\n10 9 8 7 6\n11 12 13 14 15\n20 19 18 17 16\n21 22 23 24 T\n\nThe cells containing parts $23$ and $24$ are not adjacent by an edge.\n\n1 2 3 4 5\n10 9 8 7 6\n11 12 24 22 23\n14 13 T 21 20\n15 16 17 18 19"]],"created_at":"2026-03-03 11:01:13"}}