#include using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); int n; cin>>n; if(n<3){ cout<<"001"s; if(n==2)cout<<" 002\n004 003"s; cout<<"\n"s; return 0; } vector>v(n,vector(n,0)); int lim=n*n,y=0,x=0,cnt=1; while(cnt<=lim){ while(x=0&&v.at(y).at(x)==0&&cnt<=lim)v.at(y).at(x)=cnt,++cnt,--x; if(cnt<=lim)--y,++x; while(y>=0&&v.at(y).at(x)==0&&cnt<=lim)v.at(y).at(x)=cnt,++cnt,--y; if(cnt<=lim)++y,++x; } for(int i=0;i