int main()
{
int a[100][100]={0};
int k,m,n,i,j;
scanf("%d",&n);
m=n/2-1;
i=0;
j=n-1;
for (k=1;k<=n*n;k++)
{
a[i][j]=k;
if (j==n-1 && i<n-1)
{i++;continue;}
if (i==n-1 && j >0)
{j--; continue;}
if (i>0 && j == 0)
{i--; continue;}
if (i==0 && a[i][j+1]==0)
{j++; continue;}
if (j>m && a[i+1][j]==0 && a[i][j+1]!=0)
{i++; continue;}
if (i>m && a[i][j-1]==0)
{j--; continue;}
if (j<=m && a[i-1][j]==0)
{i--; continue;}
if (i<=m && a[i][j+1]==0)
{j++; continue;}
}
for (i=0;i<n;i++)
{
for (j=0;j<n;j++)
printf("%d ",a[i][j]);
printf("\n");
}
return 0;
}