#include <bits/stdc++.h>
using namespace std;
int n, l, t;
#define LL long long
const int N = 200000;
int xi[N], dir[N], xx[N];
int main()
{
    cin >> n >> l >> t;
    LL c = 0;
    for (int i = 0; i < n; ++ i)
    {
        cin >> xi[i] >> dir[i];
        if (dir[i] == 2) dir[i] = -1;
        int nx = xi[i] + t * dir[i];
        c += (nx > 0? nx / l: (nx - l + 1) / l);
        xx[i] = (nx % l + l) % l;
    }
    sort(xx, xx + n);
    for (int i = 0; i < n; ++ i)
        cout << xx[((i + c) % n + n) % n] << "\n";
}
