#include<cstdio>
#include<algorithm>
using namespace std;
int a[1000][1000];
int main()
{
int n;
int k=1;
scanf("%d",&n);
int i = 1, j = 1;
while(k<=n*n)
{
while(j<=n && a[i][j]==0)
{
a[i][j] = k++;
j++;
}
while(i<=n&&a[i][j]==0)
{
a[i][j]=k++;
i++;
}
while(j>=1&&a[i][j]==0)
{
a[i][j]=k++;
j--;
}
while(i>=1&&a[i][j]==0)
{
a[i][j]=k++;
i--;
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}
return 0;
}
救救孩子吧QWQ