#include<iostream>
using namespace std;
int arr[50][50]={0};
int Row,Column;
void func(int i,int row,int column,int num){
if (row==1&&column!=num){
arr[num][column+1]=i;
Row=num;
Column=column+1;
}else if (column==num&&row!=1){
arr[row-1][1]=i;
Row=row-1;
Column=1;
}else if (column==num&&row==1){
arr[row-1][column]=i;
Row=row-1;
}else if (column!=num&&row!=1){
if (arr[row-1][column+1]==0){
arr[row-1][column+1]=i;
Row=row-1;
Column=column+1;
}else{
arr[row+1][column]=i;
Row=row+1;
}
}
}
int main(){
int i;
cin>>i;
arr[1][i/2+1]=1;
Row=1;
Column=i/2+1;
for (int j = 2; j <= i*i; ++j) {
func(j,Row,Column,i);
}
for (int j = 1; j <= i; ++j) {
for (int k = 1; k <= i; ++k) {
cout<<arr[j][k]<<" ";
}
cout<<endl;
}
return 0;
}