#include <iostream> #include <string> #define end '\n' using namespace std; void solve() { int n; cin >> n; string s; cin >> s; bool flag = true; bool flagred = false; int cntw = 0, cntw1 = 0; for (int i = 0; i < n; ++ i) { if (s[i] == 'W') { cntw++; if (!flagred) cntw1++; } else flagred = true; } if (cntw % 2) flag = false; if (cntw1 < cntw / 2) flag = false; bool flagwhite = false; int cntr = 0, cntr1 = 0; for (int i = 2 * n - 1; i >= n; -- i) { if (s[i] == 'R') { cntr++; if (!flagwhite) cntr1++; } else flagwhite = true; } if (cntr % 2) flag = false; if (cntr1 < cntr / 2) flag = false; if (flag) cout << "YES" << endl; else cout << "NO" << endl; } int main() { ios :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { solve(); } return 0; }