#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

#define MAX_N 5000
#define INF 10000000

int cake[MAX_N][5];//num,x1,y1,x2,y2//
int N, H, W, P, S;
int X1, Y1, X2, Y2, pos;
int W1, H1, C1, C2, C3, C4, A, SIS, SIS1, mens, enshu;
vector<int>cake2;

void MEMSET() {
	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < 5; j++) {
			cake[i][j] = 0;
		}
	}
	N = 0; H = 0; W = 0; P = 0; S = 0; pos = 0;
	W1 = 0; H1 = 0; C1 = 0; C2 = 0; C3 = 0; C4 = 0;
	A = 0; SIS = 0; SIS1 = 0; mens = 0; enshu = 0;
	cake2.clear();
}

void CAKE() {
	//one.
	if (S <= C1) {
		C4 = (S)+X1;
		A = 0;
		if (W1 < (C4 - X1) * 2) {
			A += 1;
		}
		for (int j = 0; j < 2; j++) {
			if (j == 0) {
				cake[pos][0] = INF + A;
				cake[pos][1] = X1;
				cake[pos][2] = Y1;
				cake[pos][3] = C4;
				cake[pos][4] = Y2;
			}
			if (j == 1) {
				cake[SIS1][0] = INF + A;
				cake[SIS1][1] = C4;
				cake[SIS1][2] = Y1;
				cake[SIS1][3] = X2;
				cake[SIS1][4] = Y2;
			}
			A += 1;
			if (A >= 2) {
				A = 0;
			}
		}
	}
	//two.
	else if (S <= C2) {
		C4 = (S - C1) + Y1;
		A = 0;
		if (H1 < (C4 - Y1) * 2) {
			A += 1;
		}
		for (int j = 0; j < 2; j++) {
			if (j == 0) {
				cake[pos][0] = INF + A;
				cake[pos][1] = X1;
				cake[pos][2] = Y1;
				cake[pos][3] = X2;
				cake[pos][4] = C4;
			}
			if (j == 1) {
				cake[SIS1][0] = INF + A;
				cake[SIS1][1] = X1;
				cake[SIS1][2] = C4;
				cake[SIS1][3] = X2;
				cake[SIS1][4] = Y2;
			}
			A += 1;
			if (A >= 2) {
				A = 0;
			}
		}
	}
	//three.
	else if (S <= C3) {
		C4 = X2 - (S - C2);
		A = 0;
		if (W1 < (C4 - X1) * 2) {
			A += 1;
		}
		for (int j = 0; j < 2; j++) {
			if (j == 0) {
				cake[pos][0] = INF + A;
				cake[pos][1] = X1;
				cake[pos][2] = Y1;
				cake[pos][3] = C4;
				cake[pos][4] = Y2;
			}
			if (j == 1) {
				cake[SIS1][0] = INF + A;
				cake[SIS1][1] = C4;
				cake[SIS1][2] = Y1;
				cake[SIS1][3] = X2;
				cake[SIS1][4] = Y2;
			}
			A += 1;
			if (A >= 2) {
				A = 0;
			}
		}
	}
	//four.
	else if (S > C3) {
		C4 = Y2 - (S - C3);
		A = 0;
		if (H1 < (C4 - Y1) * 2) {
			A += 1;
		}
		for (int j = 0; j < 2; j++) {
			if (j == 0) {
				cake[pos][0] = INF + A;
				cake[pos][1] = X1;
				cake[pos][2] = Y1;
				cake[pos][3] = X2;
				cake[pos][4] = C4;
			}
			if (j == 1) {
				cake[SIS1][0] = INF + A;
				cake[SIS1][1] = X1;
				cake[SIS1][2] = C4;
				cake[SIS1][3] = X2;
				cake[SIS1][4] = Y2;
			}
			A += 1;
			if (A >= 2) {
				A = 0;
			}
		}
	}
}

int main() {
	while (true) {
		MEMSET();
		cin >> N >> W >> H;
		if (N == 0 && W == 0 && H == 0) {
			break;
		}
		cake[0][0] = 1;
		cake[0][1] = 0;
		cake[0][2] = 0;
		cake[0][3] = W;
		cake[0][4] = H;
		for (int i = 0; i < N; i++) {
			cin >> P >> S;
			for (int j = 0; j <= i; j++) {
				if (cake[j][0] == P) {
					X1 = cake[j][1];
					Y1 = cake[j][2];
					X2 = cake[j][3];
					Y2 = cake[j][4];
					pos = j;
				}
			}
			W1 = (X2 - X1);
			H1 = (Y2 - Y1);
			C1 = W1;
			C2 = C1 + H1;
			C3 = C2 + W1;
			C4 = 0; A = 0;
			enshu = C2 * 2;
			SIS1 = i + 1;
			SIS = SIS1 - pos;
			S %= enshu;

			CAKE();

			for (int j = 0; j <= i; j++) {
				if (j != pos && cake[j][0] >= P) {
					cake[j][0] -= 1;
				}
			}
			if (cake[pos][0] == INF) {
				cake[pos][0] = i + 1;
			}
			else {
				cake[pos][0] = i + 2;
			}
			if (cake[SIS1][0] == INF) {
				cake[SIS1][0] = i + 1;
			}
			else {
				cake[SIS1][0] = i + 2;
			}
		}
		for (int i = 0; i < N + 1; i++) {
			W1 = (cake[i][3] - cake[i][1]);
			H1 = (cake[i][4] - cake[i][2]);
			mens = W1*H1;
			cake2.push_back(mens);
		}
		sort(cake2.begin(), cake2.end());
		for (int i = 0; i < cake2.size(); i++) {
			if (i >= 1) {
				cout << ' ';
			}
			cout << cake2[i];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1316