#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N;
int A[402020];

ll mo=3;

ll fact[403030];
ll fact3[403030];

ll modpow(ll a, ll n=mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

ll comb(int A,int B) {
	int C=A-B;
	
	if(fact3[A]>fact3[B]+fact3[C]) return 0;
	return fact[A]*modpow(fact[B]*fact[C])%mo;
	
	
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	fact[0]=1;
	fact3[0]=0;
	for(i=1;i<=N-1;i++) {
		fact[i]=fact[i-1];
		fact3[i]=fact3[i-1];
		x=i;
		while(x%3==0) {
			fact3[i]++;
			x/=3;
		}
		fact[i]=fact[i]*x%3;
	}
	
	
	
	cin>>s;
	ll ret=0;
	FOR(i,N) {
		if(s[i]=='B') A[i]=0;
		if(s[i]=='W') A[i]=1;
		if(s[i]=='R') A[i]=2;
		
		if(N%2==1) {
			ret+=comb(N-1,i)*A[i];
		}
		else {
			ret-=comb(N-1,i)*A[i];
		}
	
	}
	ret=(ret%3+3)%3;
	cout<<"BWR"[ret]<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}

#include<bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
 
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(ll i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl
#define MIN(x,y) x=min(x,y)
#define MAX(x,y) x=max(x,y)
#define left 0
#define right 1
#define pq priority_queue

const double one = 1.0;
const double PI = 3.14159265/*358979323846*/;
const ll maxn = 1e4+10;
const ld eps = 1e-14;
const ll mod = 1000000007;

map<ll,ll> cnt;

void solve()
{
	ll n,a,b;
	cin>>n>>a>>b;
	ll N = n,A = a,B = b;
	if(n-a+1 <= 0 || n-b+1 <= 0 || n-a-b+1 <= 0)
	{
		cout<<0<<endl;
		return;
	}
	ll x = ((N-A+1)*(N-B+1)-(N-A-B+2)*(N-A-B+1))%mod;
	ll aa = (N-A+1)*(N-A+1)%mod;
	ll bb = ((N-B+1)*(N-B+1)%mod);
	ll cc = (x*x%mod);
	ll res = (aa*bb+mod-cc)%mod;
	cout<<res<<Endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	cin>>t;
	while(t--)solve(); 
	return 0;
}