use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { reader: s.lock() };
    let n: usize = sc.read();
    let d1: i64 = sc.read();
    let d2: i64 = sc.read();

    let mut vertices = vec![];
    for i in 0..(2 * n) {
        for j in 0..(2 * n) {
            vertices.push((i, j));
        }
    }

    let num_v = vertices.len();
    assert_eq!(num_v, 4 * n * n);
    let graph1 = construct_graph(&vertices, n, d1);
    let mut color1 = vec![0; num_v];
    for i in 0..num_v {
        if color1[i] == 0 {
            color1[i] = 1;
            dfs(i, &graph1, &mut color1);
        }
    }

    let graph2 = construct_graph(&vertices, n, d2);
    let mut color2 = vec![0; num_v];
    for i in 0..num_v {
        if color2[i] == 0 {
            color2[i] = 1;
            dfs(i, &graph2, &mut color2);
        }
    }

    let mut component = vec![vec![vec![]; 2]; 2];
    for i in 0..num_v {
        component[color1[i] - 1][color2[i] - 1].push(vertices[i]);
    }

    for i in 0..2 {
        for j in 0..2 {
            if component[i][j].len() >= n * n {
                for &(x, y) in component[i][j].iter().take(n * n) {
                    println!("{} {}", x, y);
                }
                return;
            }
        }
    }
    unreachable!();
}

fn dfs(v: usize, graph: &Vec<Vec<usize>>, color: &mut Vec<usize>) {
    for &next in graph[v].iter() {
        if color[next] == 0 {
            color[next] = if color[v] == 1 { 2 } else { 1 };
            dfs(next, graph, color);
        }
        assert!(color[next] != color[v]);
    }
}

fn construct_graph(vertices: &Vec<(usize, usize)>, n: usize, distance: i64) -> Vec<Vec<usize>> {
    let num_v = vertices.len();
    assert_eq!(num_v, 4 * n * n);
    let mut graph = vec![vec![]; num_v];
    for from in 0..num_v {
        let (i, j) = vertices[from];
        let i = i as i64;
        let j = j as i64;
        let n = n as i64;

        for dx in 0..cmp::min(2 * n, distance + 1) {
            let dy2 = distance - dx * dx;
            if dy2 < 0 {
                continue;
            }
            let dy = (dy2 as f64).sqrt() as i64;
            if dy * dy + dx * dx != distance {
                continue;
            }

            for &(x, y) in vec![
                (i + dx, j + dy),
                (i + dx, j - dy),
                (i - dx, j + dy),
                (i - dx, j - dy),
            ]
            .iter()
            {
                if x >= 0 && y >= 0 && x < 2 * n && y < 2 * n {
                    let to = x * 2 * n + y;
                    graph[from].push(to as usize);
                }
            }
        }
    }
    graph
}
pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 206840