#include <iostream>
using namespace std;
int main()
{
int i,j,n;
cin>>n;
int mat[n][n];
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
if(i+j<n+1)
mat[i][j]=i;
if(i+j==n+1)
mat[i][j]=0;
if(i+j>n+1)
mat[i][j]=n-i+1;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<mat[i][j]<<" ";
cout<<endl;
}
return 0;
}