import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto D = [s[1], s[2]];
    auto G = new int[][][](2, 4*N*N);
    auto C = new int[][](2, 4*N*N);
    C[0][] = C[1][] = -1;

    foreach (i; 0..2) {
        foreach (x1; 0..2*N) {
            foreach (y1; 0..2*N) {
                foreach (x2; 0..2*N) {
                    int y2 = f(x1, y1, x2, D[i]);
                    if (y2 == -1) continue;
                    G[i][x1*N+y1] ~= x2*N+y2;
                }
            }
        }
    }

    foreach (i; 0..2) {
        foreach (x1; 0..2*N) {
            foreach (y1; 0..2*N) {
                if (C[i][x1*N+y1] == -1) {
                    dfs(x1*N+y1, 0, G[i], C[i]);
                }
            }
        }
    }

    int cnt = 0;

    foreach (i; 0..2) {
        foreach (j; 0..2) {
            if (C[0].count(i) + C[1].count(j) >= N * N) {
                foreach (x; 0..2*N) {
                    foreach (y; 0..2*N) {
                        if (C[0][x*N+y] == i && C[1][x*N+y] == j) {
                            writeln(x, " ", y);
                            ++cnt;
                            if (cnt >= N * N) {
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
}

void dfs(int n, int c, int[][] G, int[] C) {
    if (C[n] != -1) return;
    C[n] = c;
    foreach (m; G[n]) if (C[m] == -1) dfs(m, c^1, G, C);
}

long check(long x1, long y1, long x2, long d) {
    long D = y1 * y1 - 4 * (y1*y1 - d + (x1-x2)*(x1-x2));
    if (D < 0) return -1;
    long DD = sqrt(D.to!real).to!long;
    return DD * DD == D ? DD : -1;
}

int f(long x1, long y1, long x2, long d) {
    long DD = check(x1, y1, x2, d);
    if (DD == -1) return -1;
    long ans = 2 * y1 + DD;
    if (ans < 0 || ans % 2 == 1) return -1;
    return ans.to!int / 2;
}
