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