#include <bits/stdc++.h>
using namespace std;
int n;
long long m, t, P, pos[300010], ans[300010];
struct ant {
  long long p, d;
  int id;
  bool operator<(const ant &x) const { return p < x.p; }
} a[300010];
int main() {
  scanf("%d%lld%lld", &n, &m, &t);
  for (int i = 0; i < n; i++) {
    char drc[5];
    scanf("%lld%s", &a[i].p, drc);
    a[i].p--;
    a[i].id = i;
    a[i].d = drc[0] == 'L' ? -1 : 1;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    pos[i] = (a[i].p + a[i].d * t % m + m) % m;
    P = (P - (a[i].p + a[i].d * t - pos[i]) / m % n + n) % n;
  }
  sort(pos, pos + n);
  for (int i = 0; i < n; i++) ans[a[(i + P) % n].id] = pos[i];
  for (int i = 0; i < n; i++) printf("%lld ", ans[i] + 1);
  return 0;
}
