#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

template <typename T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
    bool done_something = false;
    stringstream res;
    res << "[";
    for (; begin_iter != end_iter and counter; ++begin_iter) {
        done_something = true;
        counter--;
        res << *begin_iter << ", ";
    }
    string str = res.str();
    if (done_something) {
        str.pop_back();
        str.pop_back();
    }
    str += "]";
    return str;
}

vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
    vector<int> ord(size);
    for (int i = 0; i < size; i++) ord[i] = i;
    sort(ord.begin(), ord.end(), compare);
    return ord;
}

template <typename T>
bool MinPlace(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool MaxPlace(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename Container>
int SZ(const Container& S) { return S.size(); }

template <typename S, typename T>
ostream& operator <<(ostream& out, const pair<S, T>& p) {
    out << "{" << p.first << ", " << p.second << "}";
    return out;
}

template <typename T>
ostream& operator <<(ostream& out, const vector<T>& v) {
    out << "[";
    for (int i = 0; i < (int)v.size(); i++) {
        out << v[i];
        if (i != (int)v.size()-1) out << ", ";
    }
    out << "]";
    return out;
}

#if DEBUG && !ONLINE_JUDGE
    ifstream input_from_file("input.txt");
    #define cin input_from_file

    #define dbg_var(x) clog << #x  << ": " << x << endl;
    #define dbg_array(x, len) clog << #x << ": " << print_iterable(x, x+len, -1) << endl;
#else
    #define dbg_var(x)
    #define dbg_array(x, len)
#endif

///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////

const int MAXN = 700;
bool usable[MAXN][MAXN];
bool vis[MAXN][MAXN];
vector<pair<int,int>> diff;
bool us_copy[MAXN][MAXN];

int N, D1, D2;


void dfs(int i, int j, bool stat) {
    // cout << i << " " << j << endl;
    vis[i][j] = true;
    usable[i][j] = stat;
    for (const auto& dd : diff) {
        int x = i + dd.first;
        int y = j + dd.second;
        if (x < 0 or x >= 2*N or y < 0 or y >= 2*N) continue;

        // cout << x << " " << y << " " << vis[x][endl;
        if (!vis[x][y]) dfs(x, y, !stat);
        if (stat == true) assert(!usable[x][y]);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); // Remove in problems with online queries!

    cin >> N >> D1 >> D2;
    set<pair<int,int>> diffS;
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
        usable[i][j] = true;
        vis[i][j] = false;
        if (i*i + j*j == D1) {
            diffS.insert({i, j});
            diffS.insert({-i, j});
            diffS.insert({i, -j});
            diffS.insert({-i, -j});
        }
    }
    vector<pair<int,int>> diff_here(diffS.begin(), diffS.end());
    diff = diff_here;
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
        if (!vis[i][j]) dfs(i, j, true);
    }
    int us_num = 0;
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) us_num += usable[i][j];
    if (2*us_num < 4*N*N) {
        // cout << "FLIP" << endl;
        for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
            usable[i][j] ^= 1;
        }
    }
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) us_copy[i][j] = usable[i][j];
    diffS.clear();
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
        if (usable[i][j]) vis[i][j] = false;
        if (i*i + j*j == D2) {
            diffS.insert({i, j});
            diffS.insert({-i, j});
            diffS.insert({i, -j});
            diffS.insert({-i, -j});
        }
    }
    vector<pair<int,int>> diff_here2(diffS.begin(), diffS.end());
    diff = diff_here2;
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
        if (!vis[i][j]) dfs(i, j, true);
    }
    us_num = 0;
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
        us_num += usable[i][j];
    }
    if (us_num < N*N) {
        // cout << "FLIP2" << endl;
        for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
            if (us_copy[i][j]) usable[i][j] ^= 1;
        }
    }
    int cc = N*N;
    for (int i = 0; i < 2*N; i++) for (int j = 0; j < 2*N; j++) {
        if (usable[i][j]) {
            cout << i << " " << j << "\n";
            cc--;
        }
        if (cc == 0) {
            return 0;
        }
    }
    assert(0);
}


Measured memory_bytes: 30336