#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,L,T; cin >> N >> L >> T;
    vector<ll> X(N),W(N);
    rep(i,N) cin >> X[i] >> W[i];

    //x >= 0 ? x % Modulus : (Modulus - (-x) % Modulus) % Modulus)
    auto modidx=[&](ll x) {
        return x >= 0 ? x%N : (N - (-x)%N)%N;
    };
    auto modpos=[&](ll x) {
        return x >= 0 ? x%L : (L - (-x)%L)%L;
    };

    vector<ll> Y(N);
    rep(i,N) {
        if (W[i]==1) Y[i] = modpos(X[i]+T);
        else Y[i] = modpos(X[i]-T);
    }

    sort(all(Y));

    auto calc=[&](int id) {
        ll cnt = 0;
        if (W[id]==1) {
            rep(i,N) {
                if (W[i]==2) {
                    ll x = X[i];
                    if (X[id] > x) x += L;
                    ll t = T*2;
                    if (t < x-X[id]) continue;
                    t -= x-X[id];
                    cnt += t / L + 1;
                }
            }
            return modidx(cnt);
        } else {
            rep(i,N) {
                if (W[i]==1) {
                    ll x = X[i];
                    if (X[id] < x) x -= L;
                    ll t = T*2;
                    if (t < X[id]-x) continue;
                    t -= X[id] - x;
                    cnt += t / L + 1;
                }
            }
            return modidx(-cnt);
        }
    };

    vector<int> ans(N);
    if (W[0]==1) {
        ll x0 = modpos(X[0]+T);
        int num = 0;
        rep(i,N) {
            if (Y[i]==x0) {
                num = i;
                if (Y[modidx(i+1)]==x0) num = modidx(num+1);
            }
        }
        int nex = calc(0);
        for (int i = nex; i < nex+N; i++) {
            ans[modidx(i)] = Y[modidx(num+i-nex)]; 
        }
    } else {
        ll x0 = modpos(X[0]-T);
        int num = 0;
        rep(i,N) {
            if (Y[i]==x0) {
                num = i;
                if (Y[modidx(i-1)]==x0) num = modidx(num-1);
            }
        }
        int nex = calc(0);
        for (int i = nex; i < nex+N; i++) {
            ans[modidx(i)] = Y[modidx(num+i-nex)]; 
        }
    }

    rep(i,N) cout << ans[i] << ln;
}


Measured memory_bytes: 6052