#include <bits/stdc++.h> using namespace std; void solve() { string s; int n; cin >> n; cin >> s; int cnt = 0; for (int i = 0; i < n; ++i) { if (s[i] == 'W') { ++cnt; } } if (cnt % 2) { cout << "NO\n"; return; } int j = 0; int nr = 0; while (1) { if (s[j] == 'W') { ++nr; if (nr == cnt / 2 + 1) break; } ++j; } // cout << j << "\n"; vector<int> used(2 * n); char need = 'W'; for (int i = 0; i < 2 * n; ++i) { if (i >= n) need = 'R'; if (used[i]) continue; if (s[i] == 'W') { while (j < 2 * n && s[j] != 'W') { ++j; } } else { while (j < 2 * n && s[j] != need) { ++j; } } if (j == 2 * n) { cout << "NO\n"; return; } swap(s[i], s[j]); used[j] = 1; ++j; } for (int i = 0; i < n; ++i) { if (s[i] == 'R') { cout << "NO\n"; return; } } cout << "YES\n"; } int main() { cin.tie(NULL); ios::sync_with_stdio(false); int t; cin >> t; while (t--) solve(); return 0; }