#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (register int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef unsigned int ui ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 1e3 + 5 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const double eps = 1e-7 ;
template <class T = int> T read()
{
	T f = 1, a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	return a * f ;
}

const int dx[4] = {1, 1, -1, -1}, dy[4] = {-1, 1, -1, 1};

int n, d1, d2;

vector <pii> c[2], ans;

int col[2][maxn][maxn], sum[4], tmp = -1;

void dfs(int x, int y, int typ, int pos)
{
	if(col[pos][x][y] != -1) return ;
	col[pos][x][y] = typ;
	for(pii i : c[pos])
	{
		rep(j, 0, 3)
		{
			int tx = x + dx[j] * i.fi, ty = y + dy[j] * i.se;
			if(tx < 0 || ty < 0 || tx >= 2 * n || ty >= 2 * n) continue;
			dfs(tx, ty, !typ, pos);
		}
	}
}

int dis(pii a, pii b)
{
	return (a.fi - b.fi) * (a.fi - b.fi) + (a.se - b.se) * (a.se - b.se);
}

signed main()
{
	scanf("%d %d %d", &n, &d1, &d2);
	rep(i, 0, 2 * n) rep(j, 0, 2 * n) if(i * i + j * j == d1) c[0].pb(mp(i, j));
	rep(i, 0, 2 * n) rep(j, 0, 2 * n) if(i * i + j * j == d2) c[1].pb(mp(i, j));
	ass(col, -1);
	rep(i, 0, 2 * n - 1) rep(j, 0, 2 * n - 1) if(col[0][i][j] == -1) dfs(i, j, 0, 0);
	rep(i, 0, 2 * n - 1) rep(j, 0, 2 * n - 1) if(col[1][i][j] == -1) dfs(i, j, 0, 1);
	rep(i, 0, 2 * n - 1) rep(j, 0, 2 * n - 1) sum[col[0][i][j] * 2 + col[1][i][j]] ++;
	rep(i, 0, 3) if(sum[i] >= n * n)
	{
		tmp = i;
		break;
	}
	rep(i, 0, 2 * n - 1) rep(j, 0, 2 * n - 1)
	{
		if(col[0][i][j] * 2 + col[1][i][j] == tmp) ans.pb(mp(i, j));
		if(siz(ans) == n * n) goto end;
	}
	end :;
	assert(siz(ans) == n * n);
	// for(pii i : ans) for(pii j : ans) if(dis(i, j) == d1 || dis(i, j) == d2) puts("NMSL"), assert(0);
	for(pii i : ans) printf("%d %d\n", i.fi, i.se);
	return 0;
}

Measured memory_bytes: 43380