def insert_sorted_array(a, i)
  (a << i; return 0) if a.size == 0
  (a << i; return 1) if a.size == 1 && a[0] < i
  (a.unshift(i); return 0) if a.size == 1
   l = 0; h = a.size - 1
  (a.unshift(i); return 0) if a[l] >= i
  (a << i; return a.size - 1) if a[h] <= i
  while(h - l > 1) do
    m = (h - l) / 2 + l
    (a[m] > i) ? h = m : l = m
  end
  a.insert(h, i)
  return h
end

Q = gets.to_i
query = []
Q.times{|q|
  query << gets.chomp.split(" ").map(&:to_i);
}

#←  l  →m←  h   →
#d = h - l
q = query.shift
a = [q[1]]
b = q[2]
d = 0
query.each{|q|
  if q[0] == 1 then
    b += q[2]
    m = (a.size - 1) / 2
    po = insert_sorted_array(a, q[1])
    if a.size.even? then
      if m >= po then
        d += a[m + 1] + a[m] - q[1]
      else
        d += q[1]
      end
    else
      if m >= po then
        d -= q[1]
      else
        d += q[1] -a[m + 1] - a[m]
      end
    end
  else
    m = (a.size - 1) / 2
    if a.size.even? then
      printf("#{a[m]} #{d - a[m] + b}\n")
    else
      printf("#{a[m]} #{d + b}\n")
    end
  end
}
