#include <bits/stdc++.h>
using namespace std;
const string filename = "test";
long long n, l, t;
pair<long long, long long> b[300011];
long long x[300011], pos[300011];
char ww[300011], w[300011];
long long ans[300011], p[600011];
long long cal(long long z) {
  long long cnt = 0;
  for (long long i = 0; i < n; i++)
    if (i != z && w[i] != w[z]) {
      long long d = 0;
      if (w[z] == 'R' && w[i] == 'L') {
        if (x[z] < x[i])
          d = x[i] - x[z];
        else
          d = l - x[z] + x[i];
      } else {
        if (x[z] > x[i])
          d = x[z] - x[i];
        else
          d = l - x[i] + x[z];
      }
      if (2 * t >= d) (cnt += (1 + (t * 2 - d) / l)) %= n;
    }
  return cnt;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l >> t;
  vector<long long> final_pos;
  for (long long i = 0; i < n; i++) {
    cin >> x[i] >> ww[i];
    x[i]--;
    b[i] = pair<long long, long long>(x[i], i);
  }
  sort(b, b + n);
  for (long long i = 0; i < n; i++) {
    w[i] = ww[b[i].second];
    x[i] = b[i].first;
    if (w[i] == 'R')
      pos[i] = (x[i] + t) % l;
    else
      pos[i] = ((x[i] - t) % l + l) % l;
    final_pos.push_back(pos[i]);
  }
  sort(final_pos.begin(), final_pos.end());
  if (final_pos.back() == final_pos[0]) {
    for (long long i = 0; i < n; i++) cout << final_pos[0] + 1 << ' ';
    return 0;
  }
  for (long long i = 0; i < 2 * n; i++) {
    if (i < n)
      p[i] = b[i].second;
    else
      p[i] = b[i - n].second;
  }
  long long cnt = cal(0);
  long long id = (0 + cnt) % n;
  if (w[0] == 'L') id = ((0 - cnt) % n + n) % n;
  for (long long i = 1; i < n; i++)
    if (pos[i] == pos[0]) {
      long long cur_cnt = cal(i);
      long long cur_id = (i + cur_cnt) % n;
      if (w[i] == 'L') cur_id = ((i - cur_cnt) % n + n) % n;
      if ((cur_id + 1) % n == id) id = cur_id;
    }
  for (long long i = 0; i < final_pos.size(); i++)
    if (final_pos[i] == pos[0]) {
      long long cur = id;
      ans[p[cur]] = pos[0];
      for (long long j = (i + 1) % (long long)(final_pos.size()); j != i;
           j = (j + 1) % (long long)(final_pos.size())) {
        cur++;
        ans[p[cur]] = final_pos[j];
      }
      break;
    }
  for (long long i = 0; i < n; i++) cout << ans[i] + 1 << ' ';
}
