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