#include <bits/stdc++.h>
using namespace std;
void init();
void solve();
int main() {
  try {
    init();
    solve();
  } catch (const char* s) {
    return 0;
  }
  return 0;
}
template <class T>
inline bool checkMin(T& a, T b) {
  return (a > b ? a = b, 1 : 0);
}
template <class T>
inline bool checkMax(T& a, T b) {
  return (a < b ? a = b, 1 : 0);
}
class Scanner {
 private:
  istream& ist;

 public:
  Scanner(istream& in) : ist(in) {}
  string next() {
    string r;
    ist >> r;
    return r;
  }
  string nextLine() {
    string r;
    getline(ist, r);
    return r;
  }
  long long nextInt() {
    long long r;
    ist >> r;
    return r;
  }
  double nextDouble() {
    double r;
    ist >> r;
    return r;
  }
  char nextChar() {
    char r;
    ist >> r;
    return r;
  }
};
Scanner sc(cin);
void ALERT(bool judgememt, const char* phrase) {
  if (judgememt) {
    puts(phrase);
    throw "ALERT";
  }
}
bool alert(bool judgememt, const char* phrase) {
  if (judgememt) puts(phrase);
  return judgememt;
}
const long long N = 300005;
long long n, m, s;
long long dir[N], pos[N];
long long rad[N], ans[N];
void init() {
  scanf("%lld%lld%lld", &n, &m, &s);
  for (long long i = 0; i < n; i++) {
    char s[5];
    scanf("%lld%s", &pos[i], s);
    pos[i]--;
    dir[i] = (s[0] == 'L') ? -1 : 1;
  }
}
void solve() {
  for (long long i = 0; i < n; i++) rad[i] = i;
  sort(rad, rad + n, [](long long a, long long b) { return pos[a] < pos[b]; });
  long long Fir = 0;
  for (long long i = 0; i < n; i++) {
    long long add =
        (dir[i] == 1) ? (pos[i] + s) / m % n : (pos[i] - s - m + 1) / m % n;
    Fir = (Fir + add + n) % n;
    pos[i] = (pos[i] + s % m * dir[i] + m + m) % m;
  }
  sort(pos, pos + n);
  for (long long i = 0; i < n; i++) ans[rad[(i - Fir + n) % n]] = pos[i] + 1;
  for (long long i = 0; i < n; i++) printf("%lld ", ans[i]);
  puts("");
}
