#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0() {}
template<typename H,typename... T> void print0(H h,T... t){cout<<fixed<<setprecision(15)<<h;print0(t...);}
void print() { print0("\n"); }
template<typename H,typename... T>void print(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print(t...);}
void ioinit() { cout << fixed << setprecision(15); ios_base::sync_with_stdio(0); cin.tie(0); }
// clang-format on
const ll MODULO = 3;
const ll COMBMAX = 400005;
ll fac[COMBMAX];
ll fthree[COMBMAX];
void combination_init() {
    fac[0] = fac[1] = 1;
    fthree[0] = fthree[1] = 0;
    for (int i = 2; i < COMBMAX; i++) {
        fthree[i] = fthree[i - 1];
        ll j = i;
        while (j % 3 == 0) {
            j = j / 3;
            fthree[i]++;
        }
        fac[i] = fac[i - 1] * j % MODULO;
    }
}
ll inv(ll v) {
    if (v == 1) return 1;
    if (v == 2) return 2;
    return 0;
}
ll combination(ll n, ll k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if (fthree[n] - fthree[k] - fthree[n - k] > 0) {
        return 0;
    }
    return fac[n] * inv(fac[n - k]) * inv(fac[k]) % MODULO;
}

int main() {
    ioinit();
    ll n;
    cin >> n;
    string s;
    cin >> s;
    vector<ll> t(n);
    for (ll i = 0; i < n; i++) {
        if (s[i] == 'B') {
            t[i] = 0;
        }
        if (s[i] == 'W') {
            t[i] = 1;
        }
        if (s[i] == 'R') {
            t[i] = 2;
        }
    }

    combination_init();
    ll sign = (n % 2 == 0) ? -1 : 1;
    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        ans += t[i] * combination(n - 1, i);
    }
    ans = ans * sign;
    ans = ans % 3;
    if (ans < 0) ans += 3;
    if (ans == 0) {
        print("B");
    }
    if (ans == 1) {
        print("W");
    }
    if (ans == 2) {
        print("R");
    }
}

#include <bits/stdc++.h>
using namespace std;
long long MOD;
int main(){
  int N, K;
  cin >> N >> K >> MOD;
  vector<vector<long long>> f(N);
  f[0].push_back(1);
  for (int i = 1; i < N; i++){
    int sz = f[i - 1].size();
    f[i] = vector<long long>(sz + i * K, 0);
    for (int j = 0; j < sz; j++){
      f[i][j] = f[i - 1][j];
    }
    for (int j = i; j < sz + i * K; j++){
      f[i][j] += f[i][j - i];
      if (f[i][j] >= MOD){
        f[i][j] -= MOD;
      }
    }
    for (int j = sz + i * K - 1; j >= i * (K + 1); j--){
      f[i][j] -= f[i][j - i * (K + 1)];
      if (f[i][j] < 0){
        f[i][j] += MOD;
      }
    }
  }
  for (int i = 0; i < N; i++){
    long long ans = 0;
    int d = min(f[i].size(), f[N - 1 - i].size());
    for (int j = 0; j < d; j++){
      ans += f[i][j] * f[N - 1 - i][j] % MOD;
      ans %= MOD;
    }
    ans *= (K + 1);
    ans %= MOD;
    ans--;
    if (ans == -1){
      ans += MOD;
    }
    cout << ans << endl;
  }
}