#include <bits/stdc++.h>
using namespace std;
const int mx = 3e5 + 10;
long long t;
int n, m;
struct Nd {
  int ps;
  int id;
} csh[mx];
int ans[mx];
int b[mx];
int p = 0;
bool cmp(const Nd &a, const Nd &b) { return a.ps < b.ps; }
int main() {
  char s[5];
  int flag;
  scanf("%d%d%I64d", &n, &m, &t);
  for (int i = 0; i < n; ++i) {
    scanf("%d%s", &csh[i].ps, s);
    --csh[i].ps;
    csh[i].id = i;
    if (s[0] == 'R')
      flag = 1;
    else
      flag = -1;
    b[i] = ((csh[i].ps + t * flag) % m + m) % m;
    p = ((p + (csh[i].ps + t * flag - b[i]) / m) % n + n) % n;
  }
  sort(csh, csh + n, cmp);
  sort(b, b + n);
  for (int i = 0; i < n; ++i) {
    ans[csh[i].id] = b[(i + p) % n] + 1;
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
}
