#include<bits/stdc++.h> using namespace std; #define pairll pair<long long,long long> #define fi first #define se second long long i,j,k,l,n,m; long long vis[200009]; main () { int nt; cin>>nt; while(nt--){ cin>>n; string s; cin>>s; for(int i=0;i<s.size();i++){ vis[i]=0; } long long cnt=0; for(i=0;i<n;i++)cnt+=s[i]=='W'; if(cnt%2!=0 || (n-cnt)%2!=0){ cout<<"NO"<<endl; continue; } k=0; vector<long long>v1,v2; for(i=0;i<n;i++){ if(s[i]=='W' && k<cnt/2)v1.push_back(i),k++,vis[i]=1; else if(s[i]=='W')v2.push_back(i),vis[i]=1; } cnt=0; for(i=0;i<n;i++){ if(s[i]=='R'){ for(j=n;j<2*n;j++){ if(vis[j])continue; if(s[j]=='W'){ v1.push_back(i); v2.push_back(j); vis[j]=1; break; } } } } cnt=0; for(i=n;i<2*n;i++)cnt+=s[i]=='R'; int flag=0; if(cnt%2!=0){ cout<<"NO"<<endl; continue; } for(i=1;i<=cnt/2;i++){ if(s[2*n-i]=='W')flag=1; } sort(v1.begin(),v1.end()); sort(v2.begin(),v2.end()); for(int i=0;i<v1.size();i++)swap(s[v1[i]],s[v2[i]]); cnt=0; for(int i=0;i<n;i++)cnt+=s[i]=='W'; if(cnt==n && flag==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; } }