#include <bits/stdc++.h>
using namespace std;
const int MAXN=10+5;
int a[MAXN][MAXN];
int main()
{
int n;
int cnt=0,heng=1,shu=0;
cin>>n;
while (cnt<n*n)
{
while (shu<n &&!a[heng][shu+1]) a[heng][shu++]=cnt++;
while (heng<n &&!a[heng+1][shu]) a[heng++][shu]=cnt++;
while (shu>1 &&!a[heng][shu-1]) a[heng][shu--]=cnt++;
while (heng>1 &&!a[heng-1][shu]) a[heng--][shu]=cnt++;
}
for (int i=1;i<=n;i++)
{
for (int j=1;j<=n;j++)
{
if (a[i][j]<10) cout<<' ';
cout<<a[i][j]<<' ';
}
cout<<endl;
}
return 0;
}