n = gets.to_i
arr = []
n.times{
    a, b = gets.chomp.split.map(&:to_i)
    arr[a + b] = 0 if arr[a + b].nil?
    arr[a + b] += 1
}
digit = 0
while true
    if arr[digit].nil?
        arr[digit] = 0
    else
        k, r = arr[digit].divmod 2
        arr[digit] = r
        add = 1
        while k > 0
            k, r = k.divmod 2
            arr[digit + add] = 0 if arr[digit + add].nil?
            arr[digit + add] += r
            add += 1
        end
    end
    digit += 1
    break if digit == arr.length
end
arr.each_with_index{|x, i| puts "#{i} 0" if x == 1}

