#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define F first #define S second #define MP make_pair typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int t; cin >> t; rep(ttt, 0, t) { int n; cin >> n; string s; cin >> s; int cnt = 0; rep(i, 0, n) { if (s[i] == 'W') cnt++; } if (cnt % 2 == 0) { bool good = true; rep(i, 0, cnt / 2) good &= s[i] == 'W'; rep(i, 0, cnt / 2) good &= s[2 * n - 1 - i] == 'R'; if (good) { cout << "YES\n"; continue; } } cout << "NO\n"; } }