#include <bits/stdc++.h>
#define MOD 1000000007

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int d1 = ri(), d2 = ri();
	std::vector<std::pair<int, int> > d1_pair;
	for (int i = 0; i <= d1; i++) {
		int64_t cur = (int64_t) d1 - (int64_t) i * i;
		int sq = sqrt(cur);
		if ((int64_t) sq * sq == cur) {
			d1_pair.push_back({i, sq});
			d1_pair.push_back({i, -sq});
		}
	}
	std::vector<std::pair<int, int> > d2_pair;
	for (int i = 0; i <= d2; i++) {
		int64_t cur = (int64_t) d2 - (int64_t) i * i;
		int sq = sqrt(cur);
		if ((int64_t) sq * sq == cur) {
			d2_pair.push_back({i, sq});
			d2_pair.push_back({i, -sq});
		}
	}
	std::vector<std::pair<int, int> > a[2 * n][2 * n];
	for (int i = 0; i < 2 * n; i++) {
		for (int j = 0; j < 2 * n; j++) {
			for (auto &k : d1_pair) {
				int x = i + k.first;
				int y = j + k.second;
				if (x < 0 || x >= 2 * n) continue;
				if (y < 0 || y >= 2 * n) continue;
				a[i][j].push_back({x, y});
				a[x][y].push_back({i, j});
			}
		}
	}
	std::vector<std::pair<int, int> > b[2 * n][2 * n];
	for (int i = 0; i < 2 * n; i++) {
		for (int j = 0; j < 2 * n; j++) {
			for (auto &k : d2_pair) {
				int x = i + k.first;
				int y = j + k.second;
				if (x < 0 || x >= 2 * n) continue;
				if (y < 0 || y >= 2 * n) continue;
				b[i][j].push_back({x, y});
				b[x][y].push_back({i, j});
			}
		}
	}
	/*
	for (int i = 0; i < 2 * n; i++) {
		for (int j = 0; j < 2 * n; j++) {
			std::cerr << i << ":" << j << std::endl;
			for (auto &k : b[i][j]) {
				std::cerr << "  " << k.first << ":" << k.second << std::endl;
			}
		}
	}*/
	
	int a12[2 * n][2 * n];
	memset(a12, 0, sizeof(a12));
	for (int i = 0; i < 2 * n; i++) {
		for (int j = 0; j < 2 * n; j++) {
			if (a12[i][j]) continue;
			std::queue<std::pair<int, int> > que;
			que.push({i, j});
			a12[i][j] = 1;
			while (que.size()) {
				auto cur = que.front();
				que.pop();
				for (auto &k : a[cur.first][cur.second]) {
					if (a12[k.first][k.second]) {
						assert(a12[k.first][k.second] == -a12[cur.first][cur.second]);
						continue;
					}
					a12[k.first][k.second] = -a12[cur.first][cur.second];
					que.push(k);
				}
			}
		}
	}
	
	int b12[2 * n][2 * n];
	memset(b12, 0, sizeof(b12));
	for (int i = 0; i < 2 * n; i++) {
		for (int j = 0; j < 2 * n; j++) {
			if (b12[i][j]) continue;
			std::queue<std::pair<int, int> > que;
			que.push({i, j});
			b12[i][j] = 1;
			while (que.size()) {
				auto cur = que.front();
				que.pop();
				
				for (auto &k : b[cur.first][cur.second]) {
					if (b12[k.first][k.second]) {
						assert(b12[k.first][k.second] == -b12[cur.first][cur.second]);
						continue;
					}
					b12[k.first][k.second] = -b12[cur.first][cur.second];
					que.push(k);
				}
			}
		}
	}
	std::vector<std::pair<int, int> > res[2][2];
	for (int i = 0; i < 2 * n; i++) {
		for (int j = 0; j < 2 * n; j++) {
			res[!!(a12[i][j] + 1)][!!(b12[i][j] + 1)].push_back({i, j});
		}
	}
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 2; j++) {
			if (res[i][j].size() >= n * n) {
				for (int k = 0; k < n * n; k++) {
					std::cout << res[i][j][k].first << " " << res[i][j][k].second << std::endl;
				}
				return 0;
			}
		}
	}
	assert(0);
	
	return 0;
}



Measured memory_bytes: 165944