#include <bits/stdc++.h>
using namespace std;

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL im(LL a, LL b) { return (a % b + b) % b; }

LL n, l, t, x[100000], w[100000];

LL cw, ccw;
LL CW[100000], CCW[100000];

LL cwc, ccwc;
LL ans_cw, ans_ccw, d;
LL f(LL z) {
	ans_cw = 0;
	ans_ccw = 0;
	if(z == 0) { return 0; }
	else {
		z--;
		ans_ccw += d;
	}
	
	cwc = (z + 1) / 2;
	ccwc = z / 2;
	ans_cw += (cwc / cw) * l;
	ans_ccw += (ccwc / ccw) * l;
	cwc %= cw;
	ccwc %= ccw;
	inc(i, cwc) { ans_cw += CW[i]; }
	inc(i, ccwc) { ans_ccw += CCW[i]; }
	
	ans_cw /=2;
	ans_ccw /=2;
	
	return ans_cw + ans_ccw;
}

int main() {
	cin >> n >> l >> t;
	inc(i, n) { cin >> x[i] >> w[i]; }
	
	inc(i, n) {
		if(w[i] == 1) { cw++; } else { w[i] = -1; ccw++; }
	}
	if(cw == 0 || ccw == 0) {
		inc(i, n) { cout << im(x[i] + t * w[i], l) << "\n"; }
		return 0;
	}
	
	
	t *= 4; l *= 4;
	inc(i, n) { x[i] *= 4; }
	
	LL p, q;
	inc(i, n) {
		int j = im(i + 1, n);
		if(w[i] == 1 && w[j] != 1) { p = i; q = j; break; }
	}
	
	d = im(x[q] - x[p], l);
	
	ccw = 0;
	LL pre = x[q];
	inc1(i, n) {
		LL qq = im(q + i, n);
		if(w[qq] != 1) {
			CCW[ccw++] = im(x[qq] - pre - 1, l) + 1;
			pre = x[qq];
		}
	}
	cw = 0;
	pre = x[p];
	inc1(i, n) {
		LL pp = im(p - i, n);
		if(w[pp] == 1) {
			CW[cw++] = im(pre - x[pp] - 1, l) + 1;
			pre = x[pp];
		}
	}
	
	LL L = 0, R = t + 1;
	while(R - L > 1) {
		LL M = (L + R) / 2;
		(f(M) < t ? L : R) = M;
	}
	
	LL e = (t - 1) - f(L); // f(L) の副作用を利用する
	LL pos = im(x[p] + ans_ccw - ans_cw + (L % 2 == 0 ? 1 : -1) * e, l);
	
	LL s[100000];
	inc(i, n) { s[i] = im(x[i] + w[i] * (t - 1), l); }
	sort(s, s + n);
	
	LL ind = -1;
	inc(i, n) { if(s[i] == pos) { ind = i; } }
	assert(ind != -1);
	
	inc(i, n) {
		int pp = im(i + ind - p, n);
		cout << im((s[pp] + 1) / 4, l / 4) << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 4352