#include <cstdio>
#include <algorithm>

#define R register
#define maxn 100010
int a[maxn];
int main()
{
	R int n, l, t, cnt = 0; scanf("%d%d%d", &n, &l, &t);
	for (R int i = 0; i < n; ++i)
	{
		R int d;
		scanf("%d%d", &a[i], &d);
		a[i] += d == 1 ? t : -t;
		cnt += a[i] / l; a[i] %= l; a[i] < 0 ? a[i] += l, --cnt : 0;
	}
	std::sort(a, a + n); ((cnt %= n) += n) %= n;
	for (R int i = 0; i < n; ++i) printf("%d\n", a[(i + cnt) % n]);
	return 0;
}
/*
4 20 9
9 1
7 2
12 1
18 1
18
7
18
1

2 2 1
0 1
1 2
*/