#include <iostream>
using namespace std;
int main()
{
int n,i,j,a[100][100],s=1;
cin>>n;
for(i=1; i<=n/2; i++)
{
for(j=i; j<=n-i; j++)
{
a[i][j]=s;
s++;
}
for(j=i; j<=n-i; j++)
{
a[j][n-i+1]=s;
s++;
}
for(j=n-i+1; j>=i+1; j--)
{
a[n-i+1][j]=s;
s++;
}
for(j=n-i+1; j>=i+1; j--)
{
a[j][i]=s;
s++;
}
}
if(n%2==1)
a[n/2+1][n/2+1]=s;
for (i=1; i<=n; i++)
{
for (j=1; j<=n; j++)
cout << a[i][j] << " ";
cout << endl;
}
return 0;
}