#include <bits/stdc++.h>
#define int long long
using namespace std;
int lf[45][45];
struct zuobiao{
int x;
int y;
};
zuobiao fd(int n, int mx){
for (int i = 1; i <= mx; i++){
for (int j = 1; j <= mx; j++){
if (lf[i][j] == n){
zuobiao ans;
ans.x=i;
ans.y=j;
return ans;
}
}
}
}
signed main(){
int n;
cin >> n;
for (int i = 1; i <= n * n; i++){
if (i == 1) lf[1][(1+n)/2]=1;
else{
zuobiao izb;
zuobiao temp=fd(i-1,n);
izb.x=(temp.x==1?n:temp.x-1);
izb.y=(temp.y==n?1:temp.y+1);
if (lf[izb.x][izb.y]!=0){
izb.x=(temp.x==n?1:temp.x+1);
izb.y=temp.y;
}
lf[izb.x][izb.y]=i;
}
}
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
cout << lf[i][j] << " ";
}
cout << "\n";
}
return 0;
}
/**************************************************************
Problem: 2344
User: 114514
Language: C++
Result: Accepted
Time:110 ms
Memory:2088 kb
****************************************************************/