old_contents: 
  surface_n = int(input())  # the number of points used to draw the surface of Mars.
  for i in range(surface_n):
      # land_x: X coordinate of a surface point. (0 to 6999)
      # land_y: Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.
      land_x, land_y = [int(j) for j in input().split()]
  
  # game loop
  while 1:
      # h_speed: the horizontal speed (in m/s), can be negative.
      # v_speed: the vertical speed (in m/s), can be negative.
      # fuel: the quantity of remaining fuel in liters.
      # rotate: the rotation angle in degrees (-90 to 90).
      # power: the thrust power (0 to 4).
      x, y, h_speed, v_speed, fuel, rotate, power = [int(i) for i in input().split()]
  
      # rotate power. rotate is the desired rotation angle. power is the desired thrust power.
      if y>2500:
          print(rotate,power)
      else:
          if v_speed<-20 and power<4:
              power+=1
              print(rotate,power)
          elif v_speed>-20 and power>0:
              power-=1
              print(rotate,power)
          else:
              print(rotate,power)
  
new_contents: '''
    Author Alumet 2015
    https://github.com/Alumet/Codingame
  '''
  
  surface_n = int(input())  # the number of points used to draw the surface of Mars.
  for i in range(surface_n):
      # land_x: X coordinate of a surface point. (0 to 6999)
      # land_y: Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.
      land_x, land_y = [int(j) for j in input().split()]
  
  # game loop
  while 1:
      # h_speed: the horizontal speed (in m/s), can be negative.
      # v_speed: the vertical speed (in m/s), can be negative.
      # fuel: the quantity of remaining fuel in liters.
      # rotate: the rotation angle in degrees (-90 to 90).
      # power: the thrust power (0 to 4).
      x, y, h_speed, v_speed, fuel, rotate, power = [int(i) for i in input().split()]
  
      # rotate power. rotate is the desired rotation angle. power is the desired thrust power.
      if y>2500:
          print(rotate,power)
      else:
          if v_speed<-20 and power<4:
              power+=1
              print(rotate,power)
          elif v_speed>-20 and power>0:
              power-=1
              print(rotate,power)
          else:
              print(rotate,power)
  
subject: Update Mars_Lander-Niveau_1.py