#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "]"; return os; }


void coloring(int y, int x, int c, int depth, vector<vector<LL>>& color, vector<pair<LL,LL>>& ng, LL n2, vector<vector<LL>>& memo){
    if(y < 0 || n2 <= y) return;
    if(x < 0 || n2 <= x) return;
    if(memo[y][x]) return;
    memo[y][x] = 1;
    if(depth & 1){
        color[y][x] |= c;
    }
    for(auto p: ng){
        coloring(y + p.first, x + p.second, c, depth+1, color, ng, n2, memo);
        coloring(y + p.second, x + p.first, c, depth+1, color, ng, n2, memo);
        coloring(y - p.first, x + p.second, c, depth+1, color, ng, n2, memo);
        coloring(y - p.second, x + p.first, c, depth+1, color, ng, n2, memo);
        coloring(y + p.first, x - p.second, c, depth+1, color, ng, n2, memo);
        coloring(y + p.second, x - p.first, c, depth+1, color, ng, n2, memo);
        coloring(y - p.first, x - p.second, c, depth+1, color, ng, n2, memo);
        coloring(y - p.second, x - p.first, c, depth+1, color, ng, n2, memo);
    }
}

int main(){
    LL n, d1, d2;
    cin >> n >> d1 >> d2;
    vector<pair<LL,LL>> ng1;
    vector<pair<LL,LL>> ng2;
    for(LL dy = 0; dy < n*2; ++dy){
        for(LL dx = dy; dx < n*2; ++dx){
            LL d = dy*dy + dx*dx;
            if(d == d1){
                ng1.push_back(pair<LL,LL>(dy, dx));
                cerr << "ng1 " << dy << ", " << dx << endl;
            }
            if(d == d2){
                ng2.push_back(pair<LL,LL>(dy, dx));
                cerr << "ng2 " << dy << ", " << dx << endl;
            }
        }
    }

    vector<vector<LL>> color(n*2, vector<LL>(n*2));
    vector<vector<LL>> memo1(n*2, vector<LL>(n*2));
    vector<vector<LL>> memo2(n*2, vector<LL>(n*2));
    for(LL y = 0; y < n*2; ++y){
        for(LL x = 0; x < n*2; ++x){
            coloring(y, x, 1, 0, color, ng1, n*2, memo1);
            coloring(y, x, 2, 0, color, ng2, n*2, memo2);
        }
    }
    /*
    for(auto line : color){
        cerr << line << endl;
    }
    */

    vector<vector<pair<LL,LL>>> groups(4);
    for(LL y = 0; y < n*2; ++y){
        for(LL x = 0; x < n*2; ++x){
            groups[color[y][x]].emplace_back(y, x);
        }
    }
    vector<pair<LL,LL>> ans;
    for(LL c = 0; c < 4; ++c){
        cerr << "group size: " << groups[c].size() << endl;
        if(groups[c].size() > ans.size()){
            ans = groups[c];
        }
    }

    ans.resize(n*n);
    for(auto p : ans){
        cout << p.second << " " << p.first << endl;
    }
    cerr << "ans size: " << ans.size() << endl;
    return 0;
}



Measured memory_bytes: 74880