#include using namespace std; using i64 = int64_t; using u64 = uint64_t; using vi64 = vector; using vu64 = vector; using vvi64 = vector; using vvu64 = vector; #define rep(i,n) for(int i=0, i##_len=(n); i> n; vvi64 a(n, vi64(n, 0)); i64 x = -1; i64 y = 0; i64 d = 0; i64 id = 1; i64 loop = 1000; while (loop--) { i64 tx = x; i64 ty = y; if (d == 0) tx++; else if (d == 1) ty++; else if (d == 2) ty--; else ty--; if (0 <= tx && tx < n && 0 <= ty && ty < n && a[ty][tx] == 0) { a[ty][tx] = id; id++; x = tx; y = ty; } else { d++; d %= 4; } } rep(i,n) vprint(a[i]); return; } int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); run(); return 0; }