#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
#include <functional>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <time.h>
#include <string>

const int MAX_N = 310;
int N, D1, D2;

void dfs(int x, int y, int c, std::vector<std::vector<int>>& colors, const std::vector<std::pair<int, int>>& prohibit) {
    if (colors[x][y] == c) {
        return;
    }
    assert(colors[x][y] == 0);
    colors[x][y] = c;
    for (auto p : prohibit) {
        int nx = x + p.first;
        int ny = y + p.second;
        if (0 <= nx && nx < N*2 && 0 <= ny && ny < N*2) {
            dfs(nx, ny, -c, colors, prohibit);
        }
    }
}

std::vector<std::vector<int>> get_color(int D) {
    std::vector<std::pair<int, int>> prohibit;
    for (int i = 0; i <= N * 2; i++) {
        for (int j = 0; j <=  N * 2; j++) {
            if (i*i + j*j == D) {
                std::pair<int, int> p;
                p.first = i;
                p.second = j;
                prohibit.push_back(p);

                p.first = -i;
                p.second = j;
                prohibit.push_back(p);

                p.first = i;
                p.second = -j;
                prohibit.push_back(p);

                p.first = -i;
                p.second = -j;
                prohibit.push_back(p);
            }
        }
    }

    std::vector<std::vector<int>> colors;
    colors.resize(N*2);
    for (int i = 0; i < N*2; i++) {
        colors[i].resize(N*2, 0);
    }

    for (int i = 0; i < N*2; i++) {
        for (int j = 0; j < N*2; j++) {
            if (colors[i][j] == 0) {
                dfs(i, j, 1, colors, prohibit);
            }
        }
    }

    return colors;
}

int main(int argc, char **argv) {
    std::cin >> N >> D1 >> D2;

    std::vector<std::vector<int>> colors1 = get_color(D1);
    std::vector<std::vector<int>> colors2 = get_color(D2);

    std::vector<std::pair<int,int>> pp, pm, mp, mm;

    for (int i = 0; i < N*2; i++) {
        for (int j = 0; j < N*2; j++) {
            if (colors1[i][j] == 1 && colors2[i][j] == 1) {
                pp.push_back(std::pair<int, int>({i, j}));
            } else if (colors1[i][j] == 1 && colors2[i][j] == -1) {
                pm.push_back(std::pair<int, int>({i, j}));
            } else if (colors1[i][j] == -1 && colors2[i][j] == 1) {
                mp.push_back(std::pair<int, int>({i, j}));
            } else if (colors1[i][j] == -1 && colors2[i][j] == -1) {
                mm.push_back(std::pair<int, int>({i, j}));
            }
        }
    }

    if (N*N <= pp.size()) {
        for (int i = 0; i < N*N; i++) {
            std::cout << pp[i].first << " " << pp[i].second << std::endl;
        }
        return 0;
    } else if (N*N <= pm.size()) {
        for (int i = 0; i < N*N; i++) {
            std::cout << pm[i].first << " " << pm[i].second << std::endl;
        }
        return 0;
    } else if (N*N <= mp.size()) {
        for (int i = 0; i < N*N; i++) {
            std::cout << mp[i].first << " " << mp[i].second << std::endl;
        }
        return 0;
    } else if (N*N <= mm.size()) {
        for (int i = 0; i < N*N; i++) {
            std::cout << mm[i].first << " " << mm[i].second << std::endl;
        }
        return 0;
    }
    
    assert(false);
    return 0;
}


Measured memory_bytes: 34808