output_description: Print N^2 distinct points that satisfy the condition in the following format:
  
      
      
      x_1 y_1
      x_2 y_2
      :
      x_{N^2} y_{N^2}
      
  
  Here, (x_i,y_i) represents the i-th chosen point. 0 ≤ x_i,y_i < 2N must hold,
  and they must be integers. The chosen points may be printed in any order. In
  case there are multiple possible solutions, you can output any.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N D_1 D_2
attempt: def circle(D):
      T = int(D**0.5) + 1
      temp = []
      for i in range(0, D + 1):
          if D - i * i < 0 or ((D - i * i) ** 0.5) % 1:
              pass
          else:
              XX = int((D - i * i) ** 0.5)
              temp.append((XX, i))
              temp.append((XX, -i))
              temp.append((-XX, i))
              temp.append((-XX, -i))
      return list(set(temp))
  
  
  def main():
  
      n = list(map(int, input().split()))
  
      N = n[0]
      D1 = n[1]
      D2 = n[2]
  
      map1 = circle(D1)
      map2 = circle(D2)
  
      mapp = [[0 for x in range(0, 2 * N)] for y in range(0, 2 * N)]
      count = 0
      mem = []
      for i in range(0, 2 * N):
          for j in range(0, 2 * N):
              if mapp[i][j] == 0:
                  count += 1
                  mapp[i][j] = 2
                  mem.append([i, j])
                  for k in map1:
                      if (
                          i + k[0] > -1
                          and j + k[1] > -1
                          and j + k[1] < 2 * N
                          and i + k[0] < 2 * N
                      ):
                          mapp[i + k[0]][j + k[1]] = 1
                      else:
                          pass
                  for k in map2:
                      if (
                          i + k[0] > -1
                          and j + k[1] > -1
                          and j + k[1] < 2 * N
                          and i + k[0] < 2 * N
                      ):
                          mapp[i + k[0]][j + k[1]] = 1
                      else:
                          pass
              else:
                  pass
              if count >= N * N:
                  break
          if count >= N * N:
              break
  
      for i in mem:
          print(i[0], i[1])
  
  
  main()
  
  """
  from scipy.special import perm, comb
  
  def C(x,y,dic,com):
      if y==0 or x == y:
          return 1
      elif (x,y) in dic.keys():
          return dic[(x,y)]
      else:
          dic[(x,y)] = comb(x,y,exact=True)#(C(x-1,y-1,dic,com)+C(x-1,y,dic,com))
          return dic[(x,y)]
  
  def main():
      MAX =  998244353
      n = list(map(int,input().split()))
      N = n[0]
      A = n[1]
      B = n[2]
      K = n[3]
  
      r = A
      g = A+B
      b = B
  
      point = []
  
      X = -1
      while(K - X * r > -1 ):
          X = X + 1
          if ((K-X * r) % (b)):
              continue
          else:
              point.append((X,int((K-X * r) / (b))))
              continue
      dic2 = []
      for i in point:
          x = i[0]
          y = 0
          z = i[1]
          while((x > -1)and(z > -1)):
              if (x + y + z) > N:
                  pass
              else:
                  dic2.append([x+y+z,x,y,z])
              x = x -1
              z = z -1
              y = y +1
      dic2.sort()
      print(dic2)
      count = 0
      dict = {}
  
      for i in dic2:
          x = i[1]
          y = i[2]
          z = i[3]
          count = (count + C(N,x,dict,comb)*C(N-x,y,dict,comb)*C(N-(x+y),z,dict,comb))%MAX
          
      print(count)
  main()
  """
  
problem_description: Statement
  
  Takahashi is doing a research on sets of points in a plane. Takahashi thinks a
  set S of points in a coordinate plane is a _good set_ when S satisfies both of
  the following conditions:
  
    * The distance between any two points in S is not \sqrt{D_1}.
    * The distance between any two points in S is not \sqrt{D_2}.
  
  Here, D_1 and D_2 are positive integer constants that Takahashi specified.
  
  Let X be a set of points (i,j) on a coordinate plane where i and j are
  integers and satisfy 0 ≤ i,j < 2N.
  
  Takahashi has proved that, for any choice of D_1 and D_2, there exists a way
  to choose N^2 points from X so that the chosen points form a good set.
  However, he does not know the specific way to choose such points to form a
  good set. Find a subset of X whose size is N^2 that forms a good set.
samples: [{"input": "2 1 2", "output": "0 0\n    0 2\n    2 0\n    2 2\n    \n\nAmong these points, the distance between 2 points is either 2 or 2\\sqrt{2},\nthus it satisfies the condition.\n\n* * *"}, {"input": "3 1 5", "output": "0 0\n    0 2\n    0 4\n    1 1\n    1 3\n    1 5\n    2 0\n    2 2\n    2 4"}]