#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main() {
int n;
int a[100][100];
while (cin >> n, n)
{
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) {
a[i][j] = pow(2, i + j);
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++)
{
cout << a[i][j] << ' ';
}
cout << endl;
}
cout << endl;
}
return 0;
}