#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1);
long long n, m, t, cnt, X[N], ans[N];
char T[10];
struct node {
  long long s, d, id;
  bool operator<(const node& rhs) const { return s < rhs.s; }
} a[N];
int main() {
  scanf("%lld%lld%lld", &n, &m, &t);
  for (int i = 0; i < n; i++) {
    scanf("%lld%s", &a[i].s, T);
    a[i].s--;
    a[i].id = i;
    if (T[0] == 'L')
      a[i].d = -1;
    else
      a[i].d = 1;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[i].d == 1) {
      X[i] = (a[i].s + t) % m;
      cnt = (cnt + (a[i].s + t) / m) % n;
    } else {
      X[i] = (a[i].s - t) % m;
      cnt = (cnt + (a[i].s - t) / m) % n;
      if (X[i] < 0) X[i] += m, cnt = (cnt - 1) % n;
    }
  }
  sort(X, X + n);
  cnt = (cnt % n + n) % n;
  int now = 0;
  for (int i = cnt; i < n; i++) ans[a[now++].id] = X[i] + 1;
  for (int i = 0; i < cnt; i++) ans[a[now++].id] = X[i] + 1;
  for (int i = 0; i < n; i++) printf("%lld ", ans[i]);
  return 0;
}
