WA了N次...
#include<string.h>
#include 
<stdio.h>

struct Rect
{
    
int w, d;
}
;

int c, w, d, cnt, p, s;
Rect rect[
110];
int area[110];

void cut()
{
    
int hw=rect[p].w, hd=rect[p].d ;
    s
%=(2*(hw+hd));
    rect[cnt]
=rect[p];
    
if(s>0 && s<hw)
    
{
        rect[p].w
=s,rect[p].d=hd;
        rect[cnt].w
=hw-rect[p].w;
    }

    
if(s>hw && s<hw+hd)
    
{
        rect[p].w
=hw,rect[p].d=s-hw;
        rect[cnt].d
=hd-rect[p].d;
    }

    
if(s>hw+hd && s<2*hw+hd)
    
{
        rect[p].w
=s-hw-hd,rect[p].d=hd;
        rect[cnt].w
=hw-rect[p].w;
    }

    
if(s>2*hw+hd && s<2*hw+2*hd)
    
{
        rect[p].w
=hw,rect[p].d=s-2*hw-hd;
        rect[cnt].d
=hd-rect[p].d;
    }

    
//
    if(rect[p].w * rect[p].d > rect[cnt].d * rect[cnt].w)
    
{
        Rect hr
=rect[p];
        rect[p]
=rect[cnt];
        rect[cnt]
=hr;
    }
      Rect hr1=rect[p];
      int i;
      for(i=p;i<cnt-1;i++)
          rect[i]=rect[i+1];
      rect[cnt-1]=hr1;

}


int main()
{
    
while(scanf("%d%d%d"&c, &w, &d)==3)
    
{
        
        
        
if(c==0 && w==0 && d==0)break;
        cnt
=1;
        
int i, j; 
        
for(i=0;i<110;i++)
            rect[i].d
=rect[i].w=area[i]=0;

        rect[
1].w=w,rect[1].d=d;

        
for(i=1;i<=c;i++)
        
{
            scanf(
"%d%d",&p,&s);
            cnt
++;
            cut();
        }

        
for(i=1;i<=c+1;i++)
        
{
        
//    printf("%d :  %d , %d  \n",i,rect[i].w,rect[i].d);
            int harea=rect[i].w * rect[i].d;
            
for(j=i;j>=1;j--)
            
{
                area[j]
=area[j-1];
                
if(harea>area[j])
                
{
                    area[j]
=harea;
                    
break;
                }

            }

        }


        
for(i=1;i<=c+1;i++)
        
{
            
if(i!=1)printf(" ");
            printf(
"%d",area[i]);
        }

        printf(
"\n");
    }

    
return 0;
}