#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/rope>
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
//
//template<class T> using Tree = tree<T, null_type, less<T>, rb_t_tag,t_order_statistics_node_update>;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______      
 * |\  \|\  \  |\  ___ \  |\  ___ \     
 * \ \  \/  /|_\ \   __/| \ \   __/|    
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__  
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \ 
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;
//const long long mod = 998244353;

// watch this
//using ll = long long;
//typedef long long LL;
#define ll long long
#undef ll

const int mxN = 610;
const int mxD = 200010;

vector<pair<int, int> > adj[mxN][mxN];
long long sq[mxD];
int A[mxN][mxN];
int B[mxN][mxN];

int get(long long D, long long dx, int y, int d) {
	long long cur = D - dx;
	if (cur == 0)
		return y;
	if (cur > mxD || cur < 0 || !sq[cur])
		return -1;
	cur = sq[cur] + y * d;
	return d * cur;
}

int C[mxN][mxN];

void dfs(int i, int j, int c) {
	if (C[i][j] != -1) {
		assert(c == C[i][j]);
		return;
	}
	C[i][j] = c;
	for (auto p : adj[i][j])
		dfs(p.first, p.second, !c);
}

int main(int argc, char** argv) {
	//#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	//#endif

	srand(time(NULL));

	for (int i = 1; i * i < mxD; i++)
		sq[i * i] = i;

	int N;
	long long D1, D2;
	cin >> N >> D1 >> D2;
//	for (int N = 1; N <= 100; N++) {
//		D1 = rand() + 1;
//		D2 = rand() + 1;
	for (int f1 = 0; f1 < 2; f1++) {
		for (int i = 0; i < (N << 1); i++)
			for (int j = 0; j < (N << 1); j++) {
				adj[i][j].clear();
				for (int k = 0; k < (N << 1); k++) {
					long long dx = (i - k) * 1ll * (i - k);
					for (int f2 = 0; f2 < 2; f2++) {
						int z = get((f1 ? D1 : D2), dx, j, (f2 ? 1 : -1));
						if (z >= 0 && z < (N << 1)) {
							assert(
									(i - k) * (i - k) + (j - z) * (j - z)
											== (f1 ? D1 : D2));
							adj[i][j].push_back( { k, z });
							(f1 ? A : B)[k][z] = !(f1 ? A : B)[i][j];
						}
					}

				}
			}
		memset(C, -1, sizeof C);
		for (int i = 0; i < (N << 1); i++)
			for (int j = 0; j < (N << 1); j++)
				if (C[i][j] == -1)
					dfs(i, j, 0);
		for (int i = 0; i < (N << 1); i++)
			for (int j = 0; j < (N << 1); j++)
				(f1 ? A : B)[i][j] = C[i][j];
	}

//		for (int i = 0; i < (N << 1); i++)
//			for (int j = 0; j < (N << 1); j++)
//				for (int k = 0; k < (N << 1); k++)
//					for (int z = 0; z < (N << 1); z++)
//						if (A[i][j] == A[k][z] && B[i][j] == B[k][z])
//							if ((i - k) * (i - k) + (j - z) * (j - z) == D1
//									|| (i - k) * (i - k) + (j - z) * (j - z)
//									== D2) {
//								cout << i << ' ' << j << ' ' << k << ' ' << z
//										<< '\n';
//								cout << N << ' ' << D1 << ' ' << D2 << '\n';
//								cout << get(D2, (i - k) * (i - k), j, 1)
//												<< '\n';
//								cout << get(D2, (i - k) * (i - k), j, -1)
//												<< '\n';
//								cout << get(D1, (i - k) * (i - k), j, 1)
//												<< '\n';
//								cout << get(D1, (i - k) * (i - k), j, -1)
//												<< '\n';
//								cout << (i - k) * (i - k) + (j - z) * (j - z)
//												<< '\n';
//								return -1;
//							}
	bool f = false;
	for (int f1 = 0; f1 < 2 && !f; f1++)
		for (int f2 = 0; f2 < 2 && !f; f2++) {
			int cnt = 0;
			for (int i = 0; i < (N << 1); i++)
				for (int j = 0; j < (N << 1); j++)
					cnt += (A[i][j] == f1 && B[i][j] == f2);
			if (cnt >= N * N) {
				cnt = 0;
				for (int i = 0; i < (N << 1); i++)
					for (int j = 0; j < (N << 1) && cnt < N * N; j++)
						if (A[i][j] == f1 && B[i][j] == f2)
							cout << i << ' ' << j << '\n', cnt++;
				f = true;
			}
		}
	assert(f);
//	}
	return 0;
}


Measured memory_bytes: 116608