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: import sys
  
  input = sys.stdin.readline
  
  
  class BIT:
      def __init__(self, n):
          self.n = n
          self.bit = [0] * (n + 1)
          self.value = [0] * (n + 1)
  
      def sum(self, i):
          s = 0
          while i > 0:
              s += self.bit[i]
              i -= i & -i
          return s
  
      def add(self, i, x):
          # assert i > 0
          self.value[i] += x
          while i <= self.n:
              self.bit[i] += x
              i += i & -i
  
      def subtract(self, i, x):
          self.add(i, -x)
  
      def init(self, n, lis):
          self.n = n
          self.bit = [0] * (n + 1)
          self.value = lis
          for i in range(n):
              self.add(i, lis[i])
  
      def get_value(self, i):
          return self.value[i]
  
      def get_sum(self, i, j):
          return self.sum(j) - self.sum(i)
  
      def lower_bound(self, x):  # 和がx以上になる最小のインデックス
          l, r = 1, self.n
          while r - l > 1:
              index = (r + l) // 2
              if self.sum(index) >= x:
                  r = index
              else:
                  l = index
  
          if self.sum(l) >= x:
              return l
          return r
  
      def upper_bound(self, x):  # 和がx以下になる最大のインデックス
          if x <= 0:
              return 0
          l, r = 0, self.n
          while r - l > 1:
              index = (r + l) // 2
              if self.sum(index) <= x:
                  l = index
              else:
                  r = index
  
          if self.sum(r) <= x:
              return r
          return l
  
  
  def main():
      q = int(input())
      query = [list(map(int, input().split())) for _ in range(q)]
  
      key = {-(10**9)}
      for i in range(q):
          if query[i][0] == 1:
              key.add(query[i][1])
  
      key = list(key)
      key.sort()
      n = len(key)
      memo = dict()
      for i, v in enumerate(key):
          memo[v] = i
  
      bit = BIT(len(key))
  
      value_min = 0
  
      for i, que in enumerate(query):
          index_min = bit.lower_bound(0)
  
          if que[0] == 2:
              print(key[index_min - 1], value_min)
              continue
  
          a, b = que[1:]
  
          value_min += b
          index = memo[a]
  
          l = r = key[index_min - 1]
          if index_min != n and bit.sum(index_min) == bit.sum(index_min + 1):
              r = key[index_min + 1]
  
          if a <= l:
              value_min += l - a
          if r <= a:
              value_min += a - r
  
          bit.subtract(1, 1)
          bit.add(index + 1, 2)
  
  
  if __name__ == "__main__":
      main()
  
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"}]