def middle(array)
    a_size = array.size
    a_size % 2 == 0 ? array[(a_size / 2) - 1] : array[a_size / 2]
end

gets
tx,ta,tb=gets.split.map(&:to_i)
a = $<.map{|s|s.split.map &:to_i}
fa = [ta]
fb = tb
a.each do |e|
    if e[0] == 2
        
        mx = middle(fa.sort)
        mm = 0
        #fa.each {|m| mm += (m-mx).abs}
        puts "#{mx} #{mm+fb}"
    else
        fa << e[1]
        fb += e[2]
    end
end