#include <cstdio>
int main() {
	int n, a, b;
	scanf("%d%d%d",&n,&a,&b);
	a = __builtin_ctz(a);
	b = __builtin_ctz(b);
	int c[4] {}, k = 0, m = n * n; n <<= 1;
	for (int x = 0; x < n; x++)
		for (int y = 0; y < n; y++)
			c[((a&1 ? x : x+y) >> (a>>1) & 1) << 1 |
			  ((b&1 ? x : x+y) >> (b>>1) & 1)]++;
	for (int i = 1; i < 4; i++)
		if (c[i] > c[k]) k = i;
	for (int x = 0; x < n; x++)
		for (int y = 0; y < n; y++)
			if ((((a&1 ? x : x+y) >> (a>>1) & 1) << 1 |
				 ((b&1 ? x : x+y) >> (b>>1) & 1)) == k) {
				printf("%d %d\n",x,y);
				if (!--m) return 0;
			}
	return 0;
}