#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const int MN = 3e5 + 10;
long long pl[MN];
short dir[MN];
pair<int, int> Tmp[MN];
int ans[MN];
int n, m;
long long shft, t;
void solve() {
  for (int i = 0; i < n; ++i) {
    if (dir[i] == 1)
      shft += ((pl[i] + t) / m) % n, shft %= n;
    else
      shft += ((pl[i] - t - m + 1) / m) % n, shft = (shft + n) % n;
    (shft += n) %= n;
    pl[i] = (1ll * pl[i] + 1ll * dir[i] * (t % m)) % m;
    (pl[i] += m) %= m;
  }
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> t;
  for (int i = 0; i < n; ++i) {
    char ch;
    cin >> pl[i] >> ch;
    --pl[i];
    dir[i] = (ch == 'R') * 2 - 1;
    Tmp[i] = {pl[i], i};
  }
  sort(Tmp, Tmp + n);
  solve();
  sort(pl, pl + n);
  for (int i = 0; i < n; ++i) ans[Tmp[(i + n - shft) % n].second] = pl[i] + 1;
  for (int i = 0; i < n; ++i) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
