#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
inline void add(long long &a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
template <typename T>
inline T const &MAX(T const &a, T const &b) {
  return a > b ? a : b;
}
template <typename T>
inline T const &MIN(T const &a, T const &b) {
  return a < b ? a : b;
}
inline long long qp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 1000000007;
    a = a * a % 1000000007, b >>= 1;
  }
  return ans;
}
inline long long qp(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % c;
    a = a * a % c, b >>= 1;
  }
  return ans;
}
using namespace std;
const unsigned long long ba = 233;
const double eps = 1e-8;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 300000 + 10, maxn = 10000000 + 10, inf = 0x3f3f3f3f;
pair<long long, int> a[N];
long long b[N], c[N];
char s[3];
int main() {
  long long n, m, t;
  scanf("%lld%lld%lld", &n, &m, &t);
  int p = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld%s", &a[i].first, s);
    a[i].first--;
    a[i].second = i;
    b[i] = ((a[i].first + t * (s[0] == 'R' ? 1 : -1)) % m + m) % m;
    p = ((p - (a[i].first + t * (s[0] == 'R' ? 1 : -1) - b[i]) / m) % n + n) %
        n;
  }
  sort(a, a + n);
  sort(b, b + n);
  for (int i = 0; i < n; i++) c[a[(i + p) % n].second] = b[i] + 1;
  for (int i = 0; i < n; i++) printf("%lld ", c[i]);
  puts("");
  return 0;
}
