#include <bits/stdc++.h> using namespace std; using ll = long long; int n; string s; vector <int> w; vector <int> r; vector <int> x; vector <pair <int,int>> v; void f(vector <int>& a){ int N=a.size()/2; for (int i=0;i<N;i++) v.push_back({a[i],a[i+N]}); } void solve(){ cin >> n >> s; w.clear(); r.clear(); x.clear(); v.clear(); for (int i=0;i<2*n;i++){ if (i<n && s[i]=='W'){ w.push_back(i); continue; } if (i>=n && s[i]=='R'){ r.push_back(i); continue; } x.push_back(i); } if (w.size()%2){ cout << "NO\n"; return; } f(w); f(r); f(x); sort(v.begin(),v.end()); //for (auto p : v) cout << p.first << " " << p.second << "\n"; for (int i=1;i<n;i++){ if (v[i-1].second>v[i].second){ cout << "NO\n"; return; } } cout << "YES\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) solve(); }