#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}
int n;
int id_calc(int a,int b){
    if(a<0||a>=2*n||b<0||b>=2*n)return -1;
    return a*2*n+b;
}

int main(){
    cin >> n;
    vector<int>d(2);
    cin >> d[0] >> d[1];
    vector<vector<int> > c(2*n*2*n,vector<int>(2));
    vector<pair<int,int> > P[2];
    rep(j,2){
        int D = d[j];
        rep(i,2*n){
            if(i*i>D)break;
            int s = D - (i*i);
            rep(k,2*n){
                if(k*k==s){
                    P[j].push_back(MP(i,k));
                    P[j].push_back(MP(i,-k));
                    P[j].push_back(MP(-i,k));
                    P[j].push_back(MP(-i,-k));
                }
                if(k*k>s)break;
            }
        }
    }
    rep(k,2){
        vector<bool> flag(2*n*2*n);
        rep(i,2*n){
            rep(j,2*n){
                if(flag[id_calc(i,j)])continue;
                flag[id_calc(i,j)] = true;
                queue<pair<int,int> >q;
                q.push(MP(i,j));
                c[id_calc(i,j)][k] = 1;
                while(!q.empty()){
                    auto y = q.front();
                    q.pop();
                    for(auto x:P[k]){
                        int nxt = id_calc(y.first+x.first,y.second+x.second);
                        if(nxt==-1)continue;
                        if(flag[nxt])continue;
                        c[nxt][k] = 3 - c[id_calc(y.first,y.second)][k];
                        q.push(MP(y.first+x.first,y.second+x.second));
                        flag[id_calc(y.first+x.first,y.second+x.second)] = true;
                    }
                }
            }
        }
    }
    for(int j=0;j<4;j++){
        int a,b;
        if(j==0){
            a = 1;
            b = 1;
        }else if(j==1){
            a = 1;
            b = 2;
        }else if(j==2){
            a = 2;
            b = 1;
        }else{
            a = 2;
            b = 2;
        }
        vector<pair<int,int> > res;
        for(int i=0;i<2*2*n*n;i++){
            if(c[i][0]==a&&c[i][1]==b){
                res.push_back(MP(i/(2*n),i%(2*n)));
            }
        }
        if(res.size()>=n*n){
            int sss = 0;
            for(auto x:res){
                cout << x.first << " " << x.second << "\n";
                sss++;
                if(sss==n*n){
                    break;
                }
            }
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 22160