#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define LL long long
#define MAXN 610
LL n, d1, d2;
bool cannot[MAXN][MAXN];

void Set(LL d) {
	LL b = 0;
	while (!(d%4)) d >>= 2, ++b;
	if (d&1) {
		for (int i = 0; i <= n << 1; ++i)
			for (int j = 0; j <= n << 1; ++j)
				if (((i >> b) + (j >> b)) & 1)
					cannot[i][j] = true;
	} else {
		for (int i = 0; i <= n << 1; ++i)
		 	for (int j = 0; j <= n << 1; ++j)
			 	if ((i >> b) & 1)
				 	cannot[i][j] = true;
	}
}
int main() {
	cin >> n >> d1 >> d2;
	Set(d1); Set(d2);
	/*for (int i = 0; i < n << 1; ++i, cout << endl)
		for (int j = 0;j < n << 1; ++j)
			cout << cannot[i][j];*/
	int cnt = 0;
	for (int i = 0; i < n << 1; ++i)
		for (int j = 0;j < n << 1; ++j)
			if (cnt < n * n && !cannot[i][j]) {
				cout << i << " " << j << endl;
				++cnt;
			}
	return 0;
}