#include<bits/stdc++.h>
using namespace std;
int n,a[1900][900] ;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i+j<=n+1) a[i][j]=n-i+1;
            else a[i][j]=j;
              
        }
          
    }
        for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cout<<setw(3)<<a[i][j];
        }
            cout<<endl;
      
    }
  
    return 0;
}
/**************************************************************
	Problem: 1202
	User: linzihang
	Language: C++
	Result: Accepted
	Time:11 ms
	Memory:8752 kb
****************************************************************/