//#pragma comment(linker, "/STACK:1024000000,1024000000")
/* vim: set fdm=marker */
//{{{
#define __ return
int ATTENTION() {
	/* pls IGNORE this function and go down and HACK me
	 * read this AFTER contest
	 * this function is empty and it will not be called !
	 */

	http://codeforces.com/group/Pmz2A2x7ES
	/* I created a group there.
	 * I hope with the group, people can finish
	 * past contests, which is important for 
	 * increasing rating.
	 * I am still getting familiar with this function.
	 */
	 __ 0;
}
// deprecated because mac doesn't support this...
/* #include <bits/stdc++.h> */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int iinf = 0x7fffffff;
const ll linf = ~(1LL<<63);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;
template<typename T>
inline T gcd(T a, T b) {
	if(a < 0) return gcd(-a, b);
	if(b < 0) return gcd( a,-b);
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a%b);
}

ll qpow(ll a, ll n, ll mod) {
	a %= mod;
	ll ans = 1LL;
	while(n) {
		if(n & 1) ans = (ans*a % mod);
		a = (a*a % mod);
		n >>= 1;
	}
	return ans;
}

inline ll rev(ll a, ll p) {
	return qpow(a, p - 2, p);
}

#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define rep(x, st, en) for(int x = st; x < en; x++)
#define rer(x, st, en) for(int x = st; x >= en; x--)
#define pb push_back
#define mp make_pair
#define dbgm(msg, var) cerr<<#msg<<" "<<#var<<" = "<<var<<endl; 
#define dbg(var) cerr<<#var<<" = "<<var<<endl;
#define X first
#define Y second
// build prefix sum
template<typename T>
inline void BPS(T* DST, T* SRC, int N, int s = 0) {
	DST[s] = SRC[s];
	rep(i, 1, N) DST[s + i] = DST[s + i - 1] + SRC[s + i];
}
inline int in() { int x; cin>>x; return x; }
#ifdef ALNDBG
namespace alndbg {
	clock_t s, e;
}
#endif

inline void tic() {
#ifdef ALNDBG
	alndbg::s = clock();
#endif
}

inline void toc() {
#ifdef ALNDBG
	alndbg::e = clock();
	cerr<<1000.0 * (alndbg::e - alndbg::s) / CLOCKS_PER_SEC<<" ms"<<endl;
#endif
}



//}}}

// -------------------- Spliters ------------------------
// BFS求最短路小心vis可能访问过
const int maxn = 302;

vector<int> E1[4*maxn*maxn];
vector<int> E2[4*maxn*maxn];
bool vis[4*maxn*maxn];
int color[4*maxn*maxn][2];
int sqr[220001];

int encode(int x, int y, int N) {
  return x * N + y;
}

vector<int> dx[2];
vector<int> dy[2];
int mx[4] = {1, -1, 1, -1};
int my[4] = {1, -1, -1, 1};
bool valid(int x, int y, int N) {
  return 0 <= x && x < 2 * N && 0 <= y && y < 2 * N;
}
void build_graph(int e12, int D, int N, vector<int> E[4*maxn*maxn]) {
  for(int x = 0; x < 2 * N; x ++) {
    for(int y = 0; y < 2 * N; y++){
      for(int j = 0; j < dx[e12].size(); j++) {
        for(int k = 0;k < 4; k++) {
          int nx = x + mx[k] * dx[e12][j];
          int ny = y + my[k] * dy[e12][j];
          if(valid(nx, ny, N)) {
            int u = encode(x, y, 2 * N);
            int v = encode(nx, ny, 2 * N);
            E[u].pb(v);
            E[v].pb(u);
          }
        }
      }
    }
  }
}

void dfs(int n, int e12, int c, vector<int> E[4*maxn*maxn]) {
  vis[n] = 1;
  color[n][e12] = c == 1 ? 2 : 1;
  for(auto to : E[n]) {
    if(vis[to]) continue;
    dfs(to, e12, c ^ 1, E);
  }
}

void prep(int i, int D, int N) {
for(int xx = 0; xx < 2 * N; xx ++){
    for(int yy = 0; yy < 2 * N; yy ++) {
      if(xx * xx + yy * yy == D) {
        dx[i].pb(xx);
        dy[i].pb(yy);
      }
    }
  }
}

int cnt[3][3];
int main() {
  
  for(int i = 0; i < 200001;i++) sqr[i] = -1;
  for(int i = 0; i * i <= 200000; i++) sqr[i * i] = i;
  int N, D1, D2;
  scanf("%d%d%d", &N, &D1, &D2);
  prep(0, D1, N); prep(1, D2, N);
  build_graph(0, D1, N, E1);
  build_graph(1, D2, N, E2);
  rep(i,0,2) {
    memset(vis, 0, sizeof(vis));
    rep(n,0,4*N*N) {
      if(!vis[n]) {
        if(i == 0) dfs(n, i, 0, E1);
        else dfs(n, i, 1, E2);
      }
    }
  }


  int c = -1;
  for(int i = 0; i < 4*N*N; i++) {
    cnt[color[i][0]][color[i][1]]++;
  }
  for(int c1 = 1; c1 <= 2; c1++)
  for(int c2 = 1; c2 <= 2; c2++) {
    if(cnt[c1][c2] < N * N) continue;
    for(int i = 0, cnt = 0; cnt < N * N; i++) {
      if(color[i][0] == c1 && color[i][1] == c2) {
        printf("%d %d\n", i / (2*N), i % ( 2 * N ));
        cnt++;
      }
    }
    return 0;
  }

	return 0;
}
// --USE C++11
// *-USE O2



Measured memory_bytes: 181248