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