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