#include<iostream>
using namespace std;
int n; 
int i,j;
void next()
	{
	 if(i==0 && j==-1) {i=-1; j=0;}

	 else if(i==-1 && j==0) {i=0;j=1;}

	 else if(i==0 && j==1) {i=1; j=0;}

	 else if(i==1 && j==0) {i=0; j=-1;}
	
	}

int main(){
freopen("F.in","r",stdin);
freopen("F.out","w",stdout);
int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};

int a[102][102];

memset(a,-1,sizeof(a));

int n;cin>>n;

for(int p=1;p<=n;p++)
for(int q=1;q<=n;q++) a[p][q]=0;



i=0;j=-1;

int cur=n*n;

int curi=n,curj=n; 

while(cur>=1)
	{
	   
	   

	   a[curi][curj]=cur;

	   if(a[curi+i][curj+j]!=0 ) next();
	
	   curi+=i;curj+=j;

	   cur--;
	
	}

for(int p=1;p<=n;p++){
for(int q=1;q<=n;q++){cout<<a[p][q]<<" ";} cout<<endl;}


return 0;
}