output_description: For each dataset, print in a line the areas looking from above of all the
  pieces that exist upon completion of the _n_ cuts specified in the dataset.
  They should be in ascending order and separated by a space. When multiple
  pieces have the same area, print it as many times as the number of the pieces.
input_description: The input is a sequence of datasets, each of which is of the following format.
  
  > _n_   _w_   _d_  
  >  _p_ 1  _s_ 1  
  >  ...  
  >  _p n_  _s n_  
  >
  
  The first line starts with an integer _n_ that is between 0 and 100 inclusive.
  It is the number of cuts to be performed. The following _w_ and _d_ in the
  same line are integers between 1 and 100 inclusive. They denote the width and
  depth of the cake, respectively. Assume in the sequel that the cake is placed
  so that _w_ and _d_ are the lengths in the east-west and north-south
  directions, respectively.
  
  Each of the following _n_ lines specifies a single cut, cutting one and only
  one piece into two. _p i_ is an integer between 1 and _i_ inclusive and is the
  identification number of the piece that is the target of the _i_ -th cut. Note
  that, just before the _i_ -th cut, there exist exactly _i_ pieces. Each piece
  in this stage has a unique identification number that is one of 1, 2, ..., _i_
  and is defined as follows:
  
    * The earlier a piece was born, the smaller its identification number is. 
    * Of the two pieces born at a time by the same cut, the piece with the smaller area (looking from above) has the smaller identification number. If their areas are the same, you may define as you like the order between them, since your choice in this case has no influence on the final answer. 
  
  Note that identification numbers are adjusted after each cut.
  
  _s i_ is an integer between 1 and 1000 inclusive and specifies the starting
  point of the _i_ -th cut. From the northwest corner of the piece whose
  identification number is _p i_, you can reach the starting point by traveling
  _s i_ in the clockwise direction around the piece. You may assume that the
  starting point determined in this way cannot be any one of the four corners of
  the piece. The _i_ -th cut surface is orthogonal to the side face on which the
  starting point exists.
  
  The end of the input is indicated by a line with three zeros.
attempt: import sys
  
  input = lambda: sys.stdin.readline().rstrip()
  sys.setrecursionlimit(10**7)
  INF = 10**10
  
  
  def I():
      return int(input())
  
  
  def F():
      return float(input())
  
  
  def S():
      return input()
  
  
  def LI():
      return [int(x) for x in input().split()]
  
  
  def LI_():
      return [int(x) - 1 for x in input().split()]
  
  
  def LF():
      return [float(x) for x in input().split()]
  
  
  def LS():
      return input().split()
  
  
  def resolve():
      while True:
          n, w, d = LI()
          if n == 0 and w == 0 and d == 0:
              break
  
          cake = []
          cake.append([w, d])
          for _ in range(n):
              ps = LI()
              p = ps[0] - 1
              s = ps[1]
              # ケーキカット
              cake_w = cake[p][0]
              cake_d = cake[p][1]
              s %= (cake_w + cake_d) * 2
              if s < cake_w:
                  new_cake_s = [min(s, cake_w - s), cake_d]
                  new_cake_l = [max(s, cake_w - s), cake_d]
              elif cake_w < s < cake_w + cake_d:
                  new_cake_s = [cake_w, min(s - cake_w, cake_w + cake_d - s)]
                  new_cake_l = [cake_w, max(s - cake_w, cake_w + cake_d - s)]
              elif cake_w + cake_d < s < cake_w + cake_d + cake_w:
                  new_cake_s = [
                      min(s - (cake_w + cake_d), cake_w + cake_d + cake_w - s),
                      cake_d,
                  ]
                  new_cake_l = [
                      max(s - (cake_w + cake_d), cake_w + cake_d + cake_w - s),
                      cake_d,
                  ]
              else:
                  new_cake_s = [
                      cake_w,
                      min(
                          s - (cake_w + cake_d + cake_w),
                          cake_w + cake_d + cake_w + cake_d - s,
                      ),
                  ]
                  new_cake_l = [
                      cake_w,
                      max(
                          s - (cake_w + cake_d + cake_w),
                          cake_w + cake_d + cake_w + cake_d - s,
                      ),
                  ]
  
              # id付け替え
              del cake[p]
              # 新ケーキ追加
              cake.append(new_cake_s)
              cake.append(new_cake_l)
  
          print(*sorted([i[0] * i[1] for i in cake]))
  
  
  if __name__ == "__main__":
      resolve()
  
problem_description: C: Cut the Cake
  
  Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest
  _p atissiers_ in the world. Those who are invited to his birthday party are
  _gourmets_ from around the world. They are eager to see and eat his extremely
  creative cakes. Now a large box-shaped cake is being carried into the party.
  It is not beautifully decorated and looks rather simple, but it must be
  delicious beyond anyone's imagination. Let us cut it into pieces with a knife
  and serve them to the guests attending the party.
  
  The cake looks rectangular, viewing from above (Figure C-1). As exemplified in
  Figure C-2, the cake will iteratively be cut into pieces, where on each cut
  exactly a single piece is cut into two smaller pieces. Each cut surface must
  be orthogonal to the bottom face and must be orthogonal or parallel to a side
  face. So, every piece shall be rectangular looking from above and every side
  face vertical.
  
  ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_c-1)  
    
  Figure C-1: The top view of the cake  
  ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_c-2)  
    
  Figure C-2: Cutting the cake into pieces
  
  Piece sizes in Figure C-2 vary significantly and it may look unfair, but you
  don't have to worry. Those guests who would like to eat as many sorts of cakes
  as possible often prefer smaller pieces. Of course, some prefer larger ones.
  
  Your mission of this problem is to write a computer program that simulates the
  cutting process of the cake and reports the size of each piece.
samples: [{"input": "5 6\n    1 18\n    2 19\n    1 2\n    3 4 1\n    1 1\n    2 1\n    3 1\n    0 2 5\n    0 0 0", "output": "4 6 16\n    1 1 1 1\n    10"}]