#include<bits/stdc++.h>
using namespace std;
int main()
{
while(1)
{
int n;
cin>>n;
if(n==0)
{
break;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
cout<<abs(i-j)+1<<" ";
}
cout<<endl;
}
cout<<endl;
}
return 0;
}