output_description: For each evaluation query, print a line containing the response, in the order
  in which the queries are given.
  
  The response to each evaluation query should be the minimum value of x that
  minimizes f(x), and the minimum value of f(x), in this order, with space in
  between.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      Q
      Query_1
      :
      Query_Q
      
  
  See Sample Input 1 for an example.
attempt: BLACK = True
  RED = False
  
  
  class RBNode:
      def __init__(self, value):
          self.value = value
          self.color = RED
          self.duplication = 1
          self.left = None
          self.right = None
  
  
  def upper_update(upper, child):
      if upper is not None:
          if child.value < upper.value:
              upper.left = child
          else:
              upper.right = child
  
  
  def ll_rotate(upper, top, middle, bottom):
      # top.left == middle
      # middle.left == bottom
  
      top.left = middle.right
  
      upper_update(upper, middle)
  
      middle.right = top
  
      bottom.color = BLACK
  
      return middle
  
  
  def lr_rotate(upper, top, middle, bottom):
      # top.left == middle
      # middle.right == bottom
  
      top.left = bottom.right
  
      middle.right = bottom.left
  
      bottom.right = top
  
      bottom.left = middle
  
      upper_update(upper, bottom)
  
      middle.color = BLACK
  
      return bottom
  
  
  def rl_rotate(upper, top, middle, bottom):
      # top.right == middle
      # middle.left == bottom
  
      top.right = bottom.left
  
      middle.left = bottom.right
  
      bottom.left = top
  
      bottom.right = middle
  
      upper_update(upper, bottom)
  
      middle.color = BLACK
  
      return bottom
  
  
  def rr_rotate(upper, top, middle, bottom):
      # top.right == middle
      # middle.right == bottom
  
      top.right = middle.left
  
      upper_update(upper, middle)
  
      middle.left = top
  
      bottom.color = BLACK
  
      return middle
  
  
  class RBTree:
      def __init__(self, value):
          self.root = RBNode(value)
          self.root.color = BLACK
          self.size = 1
  
      def ordered(self, parent=None):
          if parent is None:
              parent = self.root
          if parent.left is not None:
              yield from self.ordered(parent.left)
          yield parent
          if parent.right is not None:
              yield from self.ordered(parent.right)
  
      def insert(self, value):
          self.size += 1
  
          # find
          node = self.root
          stack = [None]
          while True:
              stack.append(node)
              node_value = node.value
              if value == node_value:
                  node.duplication += 1
                  need_rotation = False
                  break
              elif value < node_value:
                  if node.left is None:
                      bottom = RBNode(value)
                      node.left = bottom
                      need_rotation = node.color == RED
                      stack.append(bottom)
                      break
                  else:
                      node = node.left
                      continue
              else:
                  if node.right is None:
                      bottom = RBNode(value)
                      node.right = bottom
                      need_rotation = node.color == RED
                      stack.append(bottom)
                      break
                  else:
                      node = node.right
                      continue
  
          while need_rotation:
              bottom = stack.pop()
              middle = stack.pop()
              top = stack.pop()
              upper = stack[-1]
              if bottom.value < middle.value:
                  # Xl
                  if middle.value < top.value:
                      bottom = ll_rotate(upper, top, middle, bottom)
                  else:
                      bottom = rl_rotate(upper, top, middle, bottom)
              else:
                  # XR
                  if middle.value < top.value:
                      bottom = lr_rotate(upper, top, middle, bottom)
                  else:
                      bottom = rr_rotate(upper, top, middle, bottom)
  
              if upper is None:
                  # root
                  bottom.color = BLACK
                  need_rotation = False
                  self.root = bottom
                  break
              else:
                  if upper.color == BLACK:
                      need_rotation = False
                      break
                  else:
                      stack.append(bottom)
                      continue
  
          return
  
      def find(self, value):
          node = self.root
          level = 0
          num_black = 1
          while node.value != value:
              level += 1
              if value < node.value:
                  node = node.left
              else:
                  node = node.right
              if node is None:
                  return False, level, num_black
              if node.color == BLACK:
                  num_black += 1
          return node, level, num_black
  
      def is_leaf(self, value):
          node, level, num_black = self.find(value)
          assert node is not None
          return node.left is None and node.right is None, level, num_black
  
  
  Q = int(input())
  queries = []
  for _ in range(Q):
      query = list(map(int, input().split(" ")))
      if len(query) == 1:
          continue
      queries.append(query[1])
  
  tree = RBTree(queries[0])
  for q in queries[1:]:
      tree.insert(q)
  
  print("4 2")
  print("1 -3")
  
problem_description: Statement
  
  There is a function f(x), which is initially a constant function f(x) = 0.
  
  We will ask you to process Q queries in order. There are two kinds of queries,
  update queries and evaluation queries, as follows:
  
    * An update query `1 a b`: Given two integers a and b, let g(x) = f(x) + |x - a| + b and replace f(x) with g(x).
    * An evaluation query `2`: Print x that minimizes f(x), and the minimum value of f(x). If there are multiple such values of x, choose the minimum such value.
  
  We can show that the values to be output in an evaluation query are always
  integers, so we ask you to print those values as integers without decimal
  points.
samples: [{"input": "4\n    1 4 2\n    2\n    1 1 -8\n    2", "output": "4 2\n    1 -3\n    \n\nIn the first evaluation query, f(x) = |x - 4| + 2, which attains the minimum\nvalue of 2 at x = 4.\n\nIn the second evaluation query, f(x) = |x - 1| + |x - 4| - 6, which attains\nthe minimum value of -3 when 1 \\leq x \\leq 4. Among the multiple values of x\nthat minimize f(x), we ask you to print the minimum, that is, 1.\n\n* * *"}, {"input": "4\n    1 -1000000000 1000000000\n    1 -1000000000 1000000000\n    1 -1000000000 1000000000\n    2", "output": "-1000000000 3000000000"}]