#include <iostream>
using namespace std;

int val(int x, int y) {
	if(x == 0 && y == 0) return 0;
	
	int x_block = 1, y_block = 1;
	while(x_block * 2 <= x) x_block <<= 1;
	while(y_block * 2 <= y) y_block <<= 1;
	if(x > 0 && y > 0 && x_block == y_block) {
		return val(x - x_block, y - y_block);
	}else if(x > y) {
		return val(x - x_block, y) + x_block;
	}
	return val(x, y - y_block) + y_block;
}
int main() {
	// your code goes here
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			cout << val(i, j) << ' ';
		}
		cout << '\n';
	}
	return 0;
}