#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};

// ve<ve<ll>> tree;
ve <ll> ans;
ve <bool> done;
map<pair<ll, ll>, ll> val;

void dfs(ll node, ve<ll> adj[], ve<bool> &visited)
{
    visited[node] = true;

    for (int i = 0; i < (int)adj[node].size(); i += 1)
    {
        if (!visited[adj[node][i]])
        {
            // tree[node].pb(adj[node][i]);
            // tree[adj[node][i]].pb(node);
            ll x=node,y=adj[node][i];
            done[val[{x,y}]]=true;
            if (val[{x,y}]==ans[x]||val[{x,y}]==ans[y])
            {
                //nothing
            }
            else
            {
                ans[y]=val[{x,y}];
            }
            dfs(adj[node][i], adj, visited);
        }
    }
}
int main()
{
    FAST
        // freopen("input1.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
        /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
        ll n,
        m;
    cin >> n >> m;
    ans.assign(n+1,0);
    done.assign(n+1,false);
    ve<ll> adj[n + 1];
    rep(i, 0, m)
    {
        ll u, v, c;
        cin >> u >> v >> c;
        adj[u].pb(v);
        adj[v].pb(u);
        val[{u, v}] = c;
        val[{v, u}] = c;
    }
    ve<bool> visit(n + 1, false);
    dfs(1,adj,visit);
    rep (i,1,n+1)
    {
        if (done[i]==false)
        {
            rep (j,1,n+1)
            {
                if (ans[j]==0)
                {
                    ans[j]=i;
                }
            }
            break;
        }
    }
    rep (i,1,n+1)
    {
        if (ans[i]==0||visit[i]==false)
        {
            cout<<"No\n";
            return 0;
        }
    }
    rep (i,1,n+1)
    {
        cout<<ans[i]<<"\n";
    }
}

#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; string S; cin >> N >> S;

    vector<int> F(N + 1, 0), G(N + 1, 1);
    REP(i, 1, N + 1) {
        int cnt = 0, tmp = i;
        while (tmp % 3 == 0) {
            cnt++;
            tmp /= 3;
        }
        F[i] = F[i - 1] + cnt;
        G[i] = (G[i - 1] * (tmp % 3)) % 3;
    }

    auto ncr = [&](int r) {
        if (F[N - 1] - F[r] - F[N - 1 - r]) return 0;
        if (G[N - 1] == 1) {
            return (G[r] * G[N - 1 - r]) % 3;
        } else {
            return (6 - G[r] * G[N - 1 - r]) % 3;
        }
    };

    int ans = 0;
    REP(i, 0, N) {
        if (S[i] == 'B') {
            ans += ncr(i);         
        } else if (S[i] == 'R') {
            ans += 2 * ncr(i);
        }
    }
    if (N % 2 == 0) ans *= -1;

    ans = (3 + ans % 3) % 3;
    if (ans == 0) {
        cout << "W" << endl; 
    } else if (ans == 1) {
        cout << "B" << endl; 
    } else {
        cout << "R" << endl; 
    }
    return 0;
}
