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