#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long
const int maxn = 1e5+10;
ll a[maxn];
int main(){
	ll n, l, t, x, y, num = 0;
	scanf("%lld%lld%lld", &n, &l, &t);
	for(int i = 0; i < n; ++i){
		scanf("%lld%lld", &x, &y);
		a[i] = x + (y == 1 ? t : -t);
		num += a[i]/l;
		a[i] %= l;
		if(a[i] < 0) a[i] += l, num --;
	}
	num %= n;
	sort(a, a+n);
	for(int i = 0; i < n; ++i){
		if(i == n-1) printf("%lld\n", a[(i+num+n)%n]);
		else printf("%lld ", a[(i+num+n)%n]);
	}
	return 0;
}