#include<bits/stdc++.h>
using namespace std;
int a[25][25];
int main()
{
int n;
scanf("%d",&n);
int x,y,tot = 1;
memset(a,0,sizeof(a));
a[x = 0][y = 0] = 1;
while(tot < n * n)
{
while(a[x][y + 1] == 0 && y + 1 < n)
a[x][++y] = ++tot;
while(a[x + 1][y] == 0 && x + 1 < n)
a[++x][y] = ++tot;
while(a[x][y - 1] == 0 && y - 1 >= 0)
a[x][--y] = ++tot;
while(a[x - 1][y] == 0 && x - 1 >= 0)
a[--x][y] = ++tot;
}
for(int i = 0;i < n;i++)
{
for(int j = 0;j < n;j++)
{
printf("%3d",a[i][j]);
}
printf("\n");
}
return 0;
}