#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010;
int p[maxn], dir[maxn], Rk[maxn];
int ans[maxn];
int n, m;
long long t;
bool cmp(const int &a, const int &b) { return p[a] < p[b]; }
int main() {
  scanf("%d%d%I64d", &n, &m, &t);
  t %= (long long)n * m;
  for (int i = 1; i <= n; i++) {
    char ch[4];
    scanf("%d %s", &p[i], ch);
    p[i]--;
    dir[i] = (ch[0] == 'L') ? -1 : 1;
    Rk[i] = i;
  }
  sort(Rk + 1, Rk + 1 + n, cmp);
  int s = 0;
  for (int i = 1; i <= n; i++) {
    if (dir[i] == 1)
      s = (s - (p[i] + t) / m) % n;
    else
      s = (s - (p[i] - t - m + 1) / m) % n;
    p[i] = ((p[i] + dir[i] * t) % m + m) % m;
  }
  s = (s + n) % n;
  sort(p + 1, p + 1 + n);
  rotate(Rk + 1, Rk + 1 + s, Rk + 1 + n);
  for (int i = 1; i <= n; i++) ans[Rk[i]] = p[i] + 1;
  for (int i = 1; i <= n; i++) printf("%d\n", ans[i]);
  return 0;
}
