function Main(s){
  s = s.split(" ").map(a=>+a);
  var n = s[0];
  var a = g(s[1]);
  var b = g(s[2]);
  var ans = [];
  var k = n * n;
  for(var i = 0; i < 2 * n; i++)
  for(var j = 0; j < 2 * n; j++){
    if(f(a,i,j) && f(b,i,j))ans[--k] = i + " " + j;
    if(!k){console.log(ans.join("\n"));return;}
  }
}
function g(n){
  var s = 1;
  while((n & 3) === 0){
    s <<= 1;
    n >>>= 2;
  }
  return [s, n & 1];
}
function f(s,y,x){
  y = Math.floor(y / s[0]);
  if(!s[1])return !(y&1);
  x = Math.floor(x / s[0]);
  return !(x+y&1);
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));