#include <bits/stdc++.h>

using namespace std;
int t,n;
char v[2005];
int who[2005];
void solve()
{
	cin>>n;
	vector<int> pw,pr;
	for(int i=1;i<=2*n;i++)
	{
		cin>>v[i];
		who[i]=0;
	}
	for(int i=1;i<=2*n;i++)
		if(who[i]==0)
		{
			if(v[i]=='W'&&i<=n)
			{
				pw.push_back(i);
				continue;
			}
			else if(v[i]=='R'&&i>n)
			{
				pr.push_back(i);
				continue;
			}
			else
			{
				for(int j=n+1;j<=2*n;j++)
					if(who[j]==0&&v[j]=='W')
					{
						who[i]=j;
						who[j]=i;
						break;
					}
			}
			if(who[i]==0)
			{
				cout<<"NO\n";
				return;
			}
		}
	if(pw.size()%2!=0)
	{
		cout<<"NO\n";
		return;
	}
	int lg=pw.size();
	for(int i=0;i<lg/2;i++)
	{
		who[pw[i]]=pw[i+lg/2];
		who[pw[i+lg/2]]=pw[i];
	}
	for(int i=0;i<lg/2;i++)
	{
		who[pr[i]]=pr[i+lg/2];
		who[pr[i+lg/2]]=pr[i];
	}
	int p1=1;
	int p2=who[1];
	for(int i=2;i<=2*n;i++)
		if(who[i]>i)
		{
			if(p2>who[i])
			{
				cout<<"NO\n";
				return;
			}
			p2=who[i];
		}
	cout<<"YES\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>t;
	while(t--)
		solve();
	return 0;
}