#include <iostream>
using namespace std;
int a[110][110];
int main(){
int n;
while(cin>>n,n){
for (int i = 0; i <n; i ++ ){
for (int j = 0; j <n; j++ )
{
a[i][j]=abs(i-j)+1;
cout<<a[i][j]<<' ';
}
cout << endl;
}
cout<<endl;
}
return 0;
}