def cut(t, cake)
    idx = t[0] - 1
    w, d = cake.delete_at(idx)
    per = t[1] % (w + d)
    if per < w # vertical cut
        w1 = per
        w2 = w - per
        w1, w2 = [w1, w2].sort
        cake.push([w1, d])
        cake.push([w2, d])
    else # horizontal cut
        d1 = per - w
        d2 = d - d1
        d1, d2 = [d1, d2].sort
        cake.push([w, d1])
        cake.push([w, d2])
    end
    return cake
end
loop do
    n, w, d = gets.split.map(&:to_i)
    break if n == 0 && w == 0 && d == 0
    cake = [[w,d]]
    n.times do
        t = gets.split.map(&:to_i)
        cake = cut(t, cake)
    end
    puts cake.map{|s| (s[0] * s[1])}.sort.map(&:to_s) * " "
end