#include <bits/stdc++.h>   using namespace std;   bool debug = 0;   int n, m, k;   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   string direc =  RDLU ;   long long ln, lk, lm;   void etp(bool f = 0) {     puts(f ?  YES  :  NO );     exit(0);   }   void addmod(int &x, int y, int mod = 1000000007) {     x += y;     if (x >= mod) x -= mod;   }   void et() {     puts( -1 );     exit(0);   }   struct ant {     long long pos;     char d;     void rd() {       cin >> pos >> d;       pos--;     }     bool operator<(const ant &o) const { return pos < o.pos; }   } a[300105];   long long t;   int ans[300105];   vector<pair<int, int> > pre;   void fmain() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> t;     for (int(i) = 0; (i) < (int)(n); (i)++) a[i].rd();     for (int(i) = 0; (i) < (int)(n); (i)++) pre.push_back({a[i].pos, i});     sort(pre.begin(), pre.end());     long long offset = 0;     for (int(i) = 0; (i) < (int)(n); (i)++) {       if (a[i].d ==  R ) {         (offset += (a[i].pos + t) / m) %= n;         a[i].pos = (t + a[i].pos) % m;       } else {         if (t >= 1 + a[i].pos) {           offset += n - 1;           offset += n - (t - (a[i].pos + 1)) / m % n;           offset %= n;         }         a[i].pos = ((long long)a[i].pos - t) % m + m;         a[i].pos %= m;       }     }     sort(a, a + n);     for (int(i) = 0; (i) < (int)(n); (i)++)       ans[pre[i].second] = a[(i + offset) % n].pos + 1;     for (int(i) = 0; (i) < (int)(n); (i)++) cout << ans[i] <<    ;   }   int main() {     fmain();     return 0;   }   