#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
const int N = 21;
int a[N][N] = {0};
int x = 0, y = N / 2;
a[x][y] = 1;
for(int num = 2; num <= N * N; num++)
{
int nx = (x - 1 + N) % N, ny = (y + 1) % N;
if((x == 0 && y == N - 1) || (a[nx][ny] > 0))
{
nx = (x + 1) % N;
ny = y;
}
a[nx][ny] = num;
x = nx;
y = ny;
}
for(int i = 0; i < N; i++)
{
for(int j = 0; j < N; j++)
cout << setw(4) << a[i][j] << " ";
cout << endl;
}
return 0;
}