#include<stdio.h>
#include<string.h>
int main()
{
int a[10][10];
int n, x, y, tot;
scanf("%d", &n);
memset(a, 0, sizeof(a));
tot = a[x = 0][y = n - 1] = 1;
while (tot < n*n)
{
while(!a[x+1][y]&&x+1<n) a[++x][y] = ++tot;
while(!a[x][y-1]&&y-1>=0) a[x][--y] = ++tot;
while(!a[x-1][y]&&x-1>=0) a[--x][y] = ++tot;
while(!a[x][y+1]&&y+1<n) a[x][++y] = ++tot;
}
for(x=0; x<n; x++)
{
for(y=0; y<n; y++)
{
printf("%3d", a[x][y]);
}
printf("\n");
}
return 0;
}