n    = gets.to_i
aryA = []
b    = 0

n.times do
  tmp = gets.chomp
  if tmp[0] == '1'
    tmp = tmp.split.map(&:to_i)
    aryA << tmp[1]
    b += tmp[2]
  else
    y   = aryA.sort[(aryA.size / 2).ceil - 1]
    ans = 0
    aryA.each do |a|
      ans += (a - y).abs
    end
    puts [y, ans + b].join(" ")
  end
end
