#include "bits/stdc++.h"

using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase(unique(all(v)), v.end())
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
const ll inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);




#define N 400010
vii G(N, vi()); //グラフの隣接リスト表現
vii color(2, vi(N, -1));
int n;

//二部グラフかどうかを判断
bool bipartite(int k) {
	fill(all(color[k]), -1);
	stack<int> st;
	rep(u, 4 * n*n) {
		if (color[k][u] != -1) {
			continue;
		}
		color[k][u] = 0;
		st.push(u);
		int i, j;
		while (!st.empty()) {
			i = st.top();
			st.pop();
			for (j = 0; j < G[i].size(); j++) {
				if (color[k][G[i][j]] == color[k][i]) {
					//cout << "NO" << endl;
					return false;
				}
				else {
					if (color[k][G[i][j]] == -1) {
						color[k][G[i][j]] = 1 - color[k][i];
						st.push(G[i][j]);
					}
				}
			}
		}
	}
	//cout << "YES" << endl;
	return true;
}


int main() {
	vi d(2);
	cin >> n >> d[0] >> d[1];
	set<int> sq;
	rep(i, 700) {
		sq.insert(i * i);
	}
	vector<vector<pii> > p(2);
	rep(i, 2) {
		rep(j, d[i] + 1) {
			int temp = d[i] - j * j;
			if (sq.count(temp)) {
				int x = j, y = sqrt(temp);
				p[i].push_back(pii(x, y));
				p[i].push_back(pii(-x, -y));
				p[i].push_back(pii(x, -y));
				p[i].push_back(pii(-x, y));
			}
		}
	}
	rep(i, 2) {
		sort(all(p[i]));
		UNIQUE(p[i]);
	}

	rep(i, 2) {
		rep(j, 4 * n*n) {
			G[j].clear();
		}
		rep(x, 2 * n) {
			rep(y, 2 * n) {
				rep(k, p[i].size()) {
					int nx = x + p[i][k].first, ny = y + p[i][k].second;
					if (in(nx, 0, 2 * n) && in(ny, 0, 2 * n)) {
						int u = x * 2 * n + y;
						int v = nx * 2 * n + ny;
						//cout << v / (2 * n) << " " << v % (2 * n) << endl;
						G[u].push_back(v);
					}
				}
			}
		}
		assert(bipartite(i));
	}
	rep(i, 2) {
		rep(j, 2) {
			int cnt = 0;
			rep(k, 4 * n*n) {
				if (color[0][k] == i && color[1][k] == j) {
					cnt++;
				}
			}
			//DEBUG(cnt);
			if (cnt >= n * n) {
				cnt = 0;
				rep(k, 4 * n*n) {
					if (color[0][k] == i && color[1][k] == j) {
						int x = k / (2 * n), y = k % (2 * n);
						cout << x << " " << y << endl;
						cnt++;
						if (cnt == n * n) {
							return 0;
						}
					}
				}
			}
		}
	}
	assert(false);
}


Measured memory_bytes: 62308