#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=3;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

void mul(ll &a,ll b){
  a%=MOD;b%=MOD;
  a=a*b%MOD;
}

string P="RBW";

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin>>N;
  string S;
  cin>>S;

  vector<ll> two(N+1,0);
  two[0]=1;
  rep(i,N) two[i+1]=two[i]*2%MOD;

  vector<vector<ll>> above(N+1,vector<ll> (3,0));
  vector<vector<ll>> below(N+1,vector<ll> (3,0));
  above[0][1]=1;
  below[0][1]=1;
  for(int k=1;k<=N-1;k++){
      rep(j,3){
          above[k][j]=above[k-1][j];
          below[k][j]=below[k-1][j];
      }
      {
          int num=N-k;
          int cnt=0;
          while(num%3==0){
              num/=3;
              cnt++;
          }
          above[k][0]+=cnt;
          above[k][num%3]++;
      }
      {
          int num=k;
          int cnt=0;
          while(num%3==0){
              num/=3;
              cnt++;
          }
          below[k][0]+=cnt;
          below[k][num%3]++;
      }
  }

  ll ans=0;
  for(int i=0;i<N;i++){
      ll res=1;
      if(S[i]=='R') res=0;
      else if(S[i]=='B') res=1;
      else res=2;

      if(above[i][0]!=below[i][0]) res=0;
      else{
          if((above[i][2]+below[i][2])%2) mul(res,2);
      }

      mul(res,two[N-1]);
      add(ans,res);
  }

  cout<<P[ans]<<endl;

  return 0;
}

#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;

const int N = 20 + 5;
typedef long long LL;

struct Edge
{
	int to, nxt;
}line[N * N * 2];
int fist[N], idx;
int n, m;
LL ans = 1;
bool vis[N];
int col[N];
vector<int> v;

void add(int x, int y)
{
	line[idx] = {y, fist[x]};
	fist[x] = idx ++;
}

void dfs(int u)
{
	vis[u] = 1; v.push_back(u);
	for(int i = fist[u]; ~i; i = line[i].nxt)
	{
		int v = line[i].to;
		if(!vis[v]) dfs(v);
	}
}

bool check(int u)
{
	for(int i = fist[u]; ~i; i = line[i].nxt)
	{
		int v = line[i].to;
		if(col[v] == col[u]) return 0;
	}	
	return 1;
}

void dfs(int t, LL &res)
{
	if(t == v.size()) 
	{
		res ++;
		return;
	}	
	for(int i = 1; i <= 3; ++ i)
	{
		col[v[t]] = i;
		if(!check(v[t])) { col[v[t]] = 0; continue;}
		dfs(t + 1, res);
		col[v[t]] = 0;
	}
}

int main()
{
	IOS; cin >> n >> m;
	memset(fist, -1, sizeof fist);
	for(int i = 1; i <= m; ++ i)
	{
		int a, b; cin >> a >> b;
		add(a, b), add(b, a);
	}
	for(int i = 1; i <= n; ++ i)
		if(!vis[i]) 
		{
			LL res = 0;
			v.clear();
			dfs(i);
			dfs(0, res); ans *= res;	
		}
	cout << ans << endl;
	return 0;
}