#include <iostream>
#include <vector>
using namespace std;
vector< vector<int> > w(100, vector<int>(100));
int n,x=0,y=0,m=1;
void (*fp[4])(int );
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;
fp[0] = f1;
fp[1] = f2;
fp[2] = f3;
fp[3] = f4;
for(int i=0;i<=(n-1)*2;i++){
k=n-(i+1)/2;
fp[i%4](k);
};
out();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdmVjdG9yPCB2ZWN0b3I8aW50PiA+IHcoMTAwLCB2ZWN0b3I8aW50PigxMDApKTsKaW50IG4seD0wLHk9MCxtPTE7CnZvaWQgKCpmcFs0XSkoaW50ICk7CnZvaWQgZjEoaW50IG4pewogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgd1t4XVt5K2ldPW07CiAgICAgICAgbSsrOwogICAgICAgIH07CiAgICB4Kys7eSs9bi0xOwp9OwoKdm9pZCBmMihpbnQgbil7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICB3W3graV1beV09bTsKICAgICAgICBtKys7CiAgICAgICAgfTsKICAgIHgrPW4tMTt5LS07Cn07Cgp2b2lkIGYzKGludCBuKXsKICAgIGZvcihpbnQgaT0wO2k8bjtpKyspewogICAgICAgIHdbeF1beS1pXT1tOwogICAgICAgIG0rKzsKICAgICAgICB9OwogICAgeC0tO3ktPW4tMTsKfTsKCnZvaWQgZjQoaW50IG4pewogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgd1t4LWldW3ldPW07CiAgICAgICAgbSsrOwogICAgICAgIH07CiAgICB4LT1uLTE7eSsrOwp9OwoKdm9pZCBvdXQoKXsKICAgIGZvcihpbnQgaT0wO2k8bjtpKyspewogICAgICAgIGZvcihpbnQgaj0wO2o8bjtqKyspY291dDw8d1tpXVtqXTw8JyAnOwogICAgICAgIGNvdXQ8PGVuZGw7CiAgICAgICAgfTsKfTsKCmludCBtYWluKCl7CiAgICBpbnQgazsKICAgIGNpbj4+bjsKICAgIGZwWzBdID0gZjE7CiAgICBmcFsxXSA9IGYyOwogICAgZnBbMl0gPSBmMzsKICAgIGZwWzNdID0gZjQ7CiAgICBmb3IoaW50IGk9MDtpPD0obi0xKSoyO2krKyl7CiAgICAgICAgaz1uLShpKzEpLzI7CiAgICAgICAgZnBbaSU0XShrKTsKICAgICAgICAKICAgICAgICB9OwogICAgb3V0KCk7CiAgICByZXR1cm4gMDsKfQo=