#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int mod){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%mod;Rac[n-1]=modInv(Fac[n-1],mod);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 600;
struct BM {
  int L, R;
  vector<vector<int>> adj;
  vector<int> level, mate;
  void init(int l, int r){
    L = l, R = r;
    adj = vector<vector<int>>(L+R);
    level = vector<int>(L);
    mate = vector<int>(L+R, -1);
  }
  void add_edge(int u, int v) {
    //cout << u << "," << v << endl;
    adj[u].push_back(v+L);
    adj[v+L].push_back(u);
  }
  int maximum_matching() {
    function<bool(void)> levelize = [&](){
      queue<int> Q;
      for(int u=0; u<L; u++){
        level[u] = -1;
        if(mate[u] < 0) {
          level[u] = 0;
          Q.push(u);
        }
      }
      while (!Q.empty()) {
        int u = Q.front();
        Q.pop();
        for(int w: adj[u]) {
          int v = mate[w];
          if(v < 0) return true;
          if(level[v] < 0) {
            level[v] = level[u] + 1;
            Q.push(v);
          }
        }
      }
      return false;
    };
    function<bool(int)> augment = [&](int u) {
      for(int w: adj[u]) {
        int v = mate[w];
        if(v < 0 || (level[v] > level[u] && augment(v))){
          mate[u] = w;
          mate[w] = u;
          return true;
        }
      }
      return false;
    };
    int match = 0;
    while(levelize()) for(int u=0; u<L; u++) if (mate[u] < 0 && augment(u)) match++;
    return match;
  }
} bm;

int n, nn, d[2], c;
int ans[N][N];
bool b[N][N];
V<P<int, int>> v;
queue<P<int, int>> q, q2;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> d[0] >> d[1];
  nn = n*2;
  FOR(t, 0, 2){
    v.clear();
    Fill(b, false);
    for(int i=0; i*i<=d[t]; i++){
      int j = sqrt(d[t]-i*i);
      if(j*j+i*i==d[t]){
        v.eb( i,  j);
        v.eb( i, -j);
        v.eb(-i,  j);
        v.eb(-i, -j);
      }
    }
    uniq(v);
    FOR(i, 0, nn)FOR(j, 0, nn){
      if(b[i][j]) continue;
      q.emplace(i, j);
      b[i][j] = true;
      while(!q.empty()){
        while(!q.empty()){
          auto p=q.front(); q.pop();
          int _i=p.fi, _j=p.se;
          ans[_i][_j] += c*(1<<t);
          for(auto t:v){
            int __i=_i+t.fi, __j=_j+t.se;
            if(0<=__i && __i<nn && 0<=__j && __j<nn && !b[__i][__j]){
                b[__i][__j] = true;
                q2.emplace(__i, __j);
            }
          }
        }
        swap(q, q2);
        c = 1-c;
      }
    }
  }
  V<int> d(4, 0);
  FOR(i, 0, nn)FOR(j, 0, nn) d[ans[i][j]]++;
  FOR(k, 0, 4) if(d[k]>=n*n){
    c = n*n;
    FOR(i, 0, nn)FOR(j, 0, nn) if(ans[i][j]==k){
      cout << i << " " << j << endl;
      if(!--c) return 0;
    }
  }
}

Measured memory_bytes: 3328