#include <bits/stdc++.h>
using namespace std;
const long long maxn = 300005;
long long n, t, l;
long long hou[maxn];
char fx[233];
long long ans[maxn];
struct ls {
  long long x, id;
  friend bool operator<(ls a, ls b) { return a.x < b.x; }
} idd[maxn];
long long iddd[maxn];
int main() {
  scanf("%lld%lld%lld", &n, &l, &t);
  long long fromm = 0;
  for (long long i = 1, x; i <= n; ++i) {
    scanf("%lld%s", &x, fx);
    x--;
    idd[i].x = x;
    idd[i].id = i;
    if (fx[0] == 'L') {
      hou[i] = x - t;
      (fromm -= (l - hou[i] - 1) / l) %= n;
      ((hou[i] %= l) += l) %= l;
    } else {
      hou[i] = x + t;
      (fromm += hou[i] / l) %= n;
      hou[i] %= l;
    }
  }
  sort(idd + 1, idd + n + 1);
  (fromm += n) %= n;
  sort(hou + 1, hou + n + 1);
  for (int i = 1; i <= n; ++i) iddd[i] = idd[i].id;
  int cnt = 0;
  for (long long i = fromm + 1; i <= n; ++i) ans[iddd[++cnt]] = hou[i];
  for (long long i = 1; i <= fromm; ++i) ans[iddd[++cnt]] = hou[i];
  for (long long i = 1; i <= n; ++i) printf("%d ", ans[i] + 1);
  return 0;
}
