#include <iostream>
#include <vector>
using namespace std;
vector< vector<int> > w(100, vector<int>(100));
int n,x=0,y=0,m=1;
void f1(int n){
for(int i=0;i<n;i++){
w[x][y+i]=m;
m++;
};
x++;y+=n-1;
};
void f2(int n){
for(int i=0;i<n;i++){
w[x+i][y]=m;
m++;
};
x+=n-1;y--;
};
void f3(int n){
for(int i=0;i<n;i++){
w[x][y-i]=m;
m++;
};
x--;y-=n-1;
};
void f4(int n){
for(int i=0;i<n;i++){
w[x-i][y]=m;
m++;
};
x-=n-1;y++;
};
void out(){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)cout<<w[i][j]<<' ';
cout<<endl;
};
};
int main(){
int k;
cin>>n;
for(int i=0;i<=(n-1)*2;i++){
k=n-(i+1)/2;
if(i%4==0)f1(k);
if(i%4==1)f2(k);
if(i%4==2)f3(k);
if(i%4==3)f4(k);
};
out();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdmVjdG9yPCB2ZWN0b3I8aW50PiA+IHcoMTAwLCB2ZWN0b3I8aW50PigxMDApKTsKaW50IG4seD0wLHk9MCxtPTE7Cgp2b2lkIGYxKGludCBuKXsKICAgIGZvcihpbnQgaT0wO2k8bjtpKyspewogICAgICAgIHdbeF1beStpXT1tOwogICAgICAgIG0rKzsKICAgICAgICB9OwogICAgeCsrO3krPW4tMTsKfTsKCnZvaWQgZjIoaW50IG4pewogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgd1t4K2ldW3ldPW07CiAgICAgICAgbSsrOwogICAgICAgIH07CiAgICB4Kz1uLTE7eS0tOwp9OwoKdm9pZCBmMyhpbnQgbil7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICB3W3hdW3ktaV09bTsKICAgICAgICBtKys7CiAgICAgICAgfTsKICAgIHgtLTt5LT1uLTE7Cn07Cgp2b2lkIGY0KGludCBuKXsKICAgIGZvcihpbnQgaT0wO2k8bjtpKyspewogICAgICAgIHdbeC1pXVt5XT1tOwogICAgICAgIG0rKzsKICAgICAgICB9OwogICAgeC09bi0xO3krKzsKfTsKCnZvaWQgb3V0KCl7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICBmb3IoaW50IGo9MDtqPG47aisrKWNvdXQ8PHdbaV1bal08PCcgJzsKICAgICAgICBjb3V0PDxlbmRsOwogICAgICAgIH07Cn07CgppbnQgbWFpbigpewogICAgaW50IGs7CiAgICBjaW4+Pm47CiAgICBmb3IoaW50IGk9MDtpPD0obi0xKSoyO2krKyl7CiAgICAgICAgaz1uLShpKzEpLzI7CiAgICAgICAgaWYoaSU0PT0wKWYxKGspOwogICAgICAgIGlmKGklND09MSlmMihrKTsKICAgICAgICBpZihpJTQ9PTIpZjMoayk7CiAgICAgICAgaWYoaSU0PT0zKWY0KGspOwogICAgICAgIH07CiAgICBvdXQoKTsKICAgIHJldHVybiAwOwp9Cg==