#include<iostream>
#include <iomanip>
using namespace std;
int main()
{
int n,i,j,a[25][25],k=0;
cin>>n;
for (j=1;j<=n;j++)
{for (i=1;i<=n;i++)
a[i][j]=n+k;
k--;
}
for(i=0;i<=n;i++)
a[i][i]=0; //elementele de pe diagonala principala
for (i=1;i<=n;i++)
{for (j=1;j<=n;j++)
cout<<setw(4)<<a[i][j]; //afisarea cu spatii, declarata cu <iomanip>
cout<<endl;
}
}