#include <bits/stdc++.h> using namespace std; void solve(){ int n; cin >> n; string s; cin >> s; int cw = 0, fr = 500; for (int i = 0; i < n; i++) { cw += s[i] == 'W'; if(s[i] == 'R'){ fr = min(fr, i); } } if(cw % 2 != 0 or cw / 2 > fr){ cout << "NO\n"; return; } int cw2 = 0; int wlast = 0; for (int i=n; i<2*n; ++i) { cw2 += s[i] == 'W'; if (s[i] == 'W') { wlast = i; } } if (cw/2 + cw2 > n) { cout << "NO\n"; return; } if (cw/2 + cw2 + 2*n - 1 - wlast < n) { cout << "NO\n"; return; } cout << "YES\n"; return; } int main(){ int t; cin >> t; while(t--) solve(); }