#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 500;
int n, m, p[N], ra[N], dir[N], ans[N];
bool cmp(int x, int y) { return p[x] < p[y]; }
long long s;
int main() {
  scanf("%d%d%I64d", &n, &m, &s);
  for (int i = 0; i <= n - 1; i++) {
    char ch[10];
    scanf("%d %s", p + i, ch);
    --p[i];
    ra[i] = i;
    dir[i] = ch[0] == 'L' ? -1 : 1;
  }
  sort(ra, ra + n, cmp);
  int t = 0;
  for (int i = 0; i <= n - 1; i++) {
    if (dir[i] == 1)
      t += (p[i] + s) / m % n;
    else
      t += (p[i] - s - m + 1) / m % n;
    t = (t % n + n) % n;
    p[i] = p[i] + s % m * dir[i];
    p[i] = (p[i] % m + m) % m;
  }
  sort(p, p + n);
  for (int i = 0; i <= n - 1; i++) ans[ra[(i + n - t) % n]] = p[i] + 1;
  for (int i = 0; i <= n - 1; i++)
    printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
  return 0;
}
