#include <bits/stdc++.h> using namespace std; #define int long long #define F first #define S second void solve() { int n; cin >> n; string s; cin >> s; int cnt1 = 0, cnt2 = 0; bool ok = false; for (int i = 0; i < n; i++) { if (s[i] == 'R') ok = true; if (s[i] == 'W') { if (ok) cnt2++; cnt1++; } } if (cnt1%2 == 1) { cout << "NO" << "\n"; return; } if (cnt2*2 > cnt1) { cout << "NO" << "\n"; return; } ok = false; cnt2 = 0; for (int i = 2*n-1; i >= n; i--) { if (s[i] == 'W') break; if (s[i] == 'R') cnt2++; } //~ cout << cnt1 << " " << cnt2 << "\n"; if (cnt2*2 < cnt1) { cout << "NO" << "\n"; return; } cout << "YES" << "\n"; } signed main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) solve(); }