#include <bits/stdc++.h>
using namespace std;
int n, m;
long long L, cnt;
int p[300010], id[300010], a[300010], b[300010];
int ans[300010];
inline int cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  scanf("%d%d%lld", &n, &m, &L);
  for (int i = 0; i < n; i++) {
    char c;
    scanf("%d %c", &a[i], &c);
    a[i]--;
    if (c == 'R')
      b[i] = 1;
    else
      b[i] = -1;
    id[i] = i;
    p[i] = ((L * b[i] + a[i]) % m + m) % m;
    cnt = ((cnt + (L * b[i] + a[i] - p[i]) / m) % n + n) % n;
  }
  sort(id, id + n, cmp);
  sort(p, p + n);
  for (int i = 0; i < n; i++) ans[id[i]] = p[(i + cnt) % n] + 1;
  for (int i = 0; i < n; i++) printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
}
