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