q = gets.to_i
queries = q.times.map { gets.split.map(&:to_i) }
c = 0
ipoints = []

queries.each do |type, a, b|
  case type
  when 1
    ipoints.push(a)
    ipoints.sort!
    c += b
  when 2
    if ipoints.size.odd?
      puts "#{ipoints[ipoints.size/2]} #{c}"
    else
      left = ipoints[ipoints.size/2-1]
      right = ipoints[ipoints.size/2]
      puts "#{ipoints[ipoints.size/2-1]} #{right - left + c}"
    end
  end
end
