def cut_at (x, y, len)
  mod = len % ((x + y) * 2)
  return [mod, 0] if mod < x
  mod -= x
  return [0, mod] if mod < y
  mod -= y
  return [x - mod, 0] if mod < x
  mod -= x
  return [0, y - mod]
end

def cut(piece, i, len)
  target = piece.delete_at(i - 1)
  sx, sy = target[0]
  tx, ty = target[1]
  x, y = tx - sx, ty - sy
  dx, dy = cut_at(x, y, len)
  nsx = sx + dx; nsy = sy + dy
  old = dx == 0 ? [[sx, sy], [tx, nsy]] : [[sx, sy], [nsx, ty]]
  now = [[nsx, nsy], [tx, ty]]
  if dx == 0 ? y > dy * 2 : x > dx * 2
    piece << old
    piece << now
  else
    piece << now
    piece << old
  end
end

loop do
  n, w, d = gets.split.map(&:to_i)
  break if n == 0 && w == 0 && d == 0
  piece = []
  piece << [[0, 0], [w, d]]
  n.times.each do
    i, len = gets.split.map(&:to_i)
    cut(piece, i, len)
  end
  puts piece.map{ |(sx, sy), (tx, ty)|
    (ty - sy) * (tx - sx)
  }.sort.join(' ')
end