#include<stdio.h>
int main()
{
int a[20][20]={0},i,j,k,l,cnt=1,x,y;
scanf("%d",&k);
for(i=0,x=k;i<k;i++,x--)
{
for(j=i,y=i;y<x;y++,cnt++)
{
a[j][y]=cnt;
}
for(j=i+1,y=x-1;j<x;j++,cnt++)
{
a[j][y]=cnt;
}
for(j=x-1,y=x-2;y>=i;y--,cnt++)
{
a[j][y]=cnt;
}
for(j=x-2,y=x;y>=i+1;j--,cnt++)
{
a[j][y]=cnt;
}
}
for(j=0;j<k;j++)
{
for(y=0;y<k;y++)
{
printf("%3d",a[j][y]);
}
printf("\n");
}
return 0;
}