#include <iostream>
#include <bitset>
using namespace std;

// A346298		a(n) is the smallest nonnegative number not yet in a(0..n-1)
// 				such that the sequence a(0..n) forms the starting row of
// 				an XOR-triangle with only distinct values in each row.

#define MAX		10001		// number of terms
#define VMAX	(1<<21)		// this must be a power of 2!

bitset<VMAX> *seen = 0;
int diag[2][MAX+1];			// 2 diagonals of XOR triangle (as a cyclic buffer)

int main() {
	int d = 0;	// current diagonal
	int p = 1;	// previous diagonal

	seen = new bitset<VMAX>[MAX];

	for (int n=0; n<MAX; n++) {
		bool found = false;
		for (int v=0; v<VMAX; v++) {
			if (!seen[0][v]) {
				bool ok = true;
				diag[d][0] = v;
				for (int k=1; k<=n; k++) {
					diag[d][k] = diag[d][k-1] ^ diag[p][k-1];
					if (seen[k][diag[d][k]]) {
						ok = false;
						break;
					}
				}

				if (ok) {
					cout << n << ' ' << v << endl;
					for (int k=0; k<=n; k++) {
						seen[k][diag[d][k]] = true;
					}
					found = true;
					break;
				}
			}
		}

		if (!found) {
			break;
		}

		d = 1-d;
		p = 1-p;
	}

theEnd:
	delete[] seen;

	return 0;
}