#include<bits/stdc++.h>
#define MAX 17
using namespace std;
int magic_square[MAX][MAX];
int main()
{
int n,i,j,sum,num,row,col,new_line=0;
while(scanf("%d",&n)!=EOF)
{
sum = n*(((n*n)+1)/2);
if(new_line)
{
puts("");
}
new_line = 1;
printf("n=%d, sum=%d\n",n,sum);
num = 1;
row = 1;
col = n/2+1;
memset(magic_square,0,sizeof(magic_square));
magic_square[row][col] = num;
while(num<(n*n))
{
row = row-1;
col = col+1;
if(row<1)
{
row = n;
}
if(col>n)
{
col = 1;
}
if(magic_square[row][col]==0)
{
magic_square[row][col] = ++num;
}
else
{
row = row+1;
col = col-1;
if(row>n)
{
row = 1;
}
if(col<1)
{
col = n;
}
row = row+1;
if(row>n)
{
row = 1;
}
if(magic_square[row][col]==0)
{
magic_square[row][col] = ++num;
}
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(n<=3)
{
printf(" %d",magic_square[i][j]);
}
else if(n<=9)
{
printf(" %2d",magic_square[i][j]);
}
else
{
printf(" %3d",magic_square[i][j]);
}
}
puts("");
}
}
return 0;
}