#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MAX_MOD 1000000007 #define REP(i,n) for(int i = 0;i < n;++i) int hoge[100][100] = {}; int main() { int n; cin >> n; pair now_here = make_pair(1,1); hoge[1][1] = 1; for (int i = 0;i < n;++i) { hoge[0][i+1] = 99999; hoge[i+1][0] = 99999; hoge[i+1][n+1] = 99999; hoge[n+1][i+1] = 99999; } int going = 0; while (true) { if (going == 0) { if (hoge[now_here.first + 1][now_here.second] == 0) { hoge[now_here.first + 1][now_here.second] = hoge[now_here.first][now_here.second] + 1; now_here.first++; } else { if (hoge[now_here.first][now_here.second+1] == 0) { going = 1; } else goto endout; } }else if (going == 1) { if (hoge[now_here.first][now_here.second + 1] == 0) { hoge[now_here.first][now_here.second + 1] = hoge[now_here.first][now_here.second] + 1; now_here.second++; } else { if (hoge[now_here.first - 1][now_here.second] == 0) { going = 2; } else goto endout; } }else if (going == 2) { if (hoge[now_here.first - 1][now_here.second] == 0) { hoge[now_here.first - 1][now_here.second] = hoge[now_here.first][now_here.second] + 1; now_here.first--; } else { if (hoge[now_here.first][now_here.second - 1] == 0) { going = 3; } else goto endout; } } else if (going == 3) { if (hoge[now_here.first][now_here.second - 1] == 0) { hoge[now_here.first][now_here.second - 1] = hoge[now_here.first][now_here.second] + 1; now_here.second--; } else { if (hoge[now_here.first + 1][now_here.second] == 0) { going = 0; } else goto endout; } } } endout:; for (int i = 1;i <= n;++i) { for (int q = 1;q <= n;++q) { if (hoge[q][i] < 100) { cout << "0"; } if (hoge[q][i] < 10) { cout << "0"; } cout << hoge[q][i] << " "; } cout << endl; } return 0; }