#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<ll, ll>; using vi = vector<ll>; using vvi = vector<vi>; #define rep(i, a, b) for(ll i = a; i < (b); ++i) #define all(x) begin(x),end(x) #define sz(x) (int)(x).size() int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout << setprecision(9) << fixed; ll t; cin >> t; rep(ti, 0, t) { ll n; cin >> n; string total; cin >> total; string first = total.substr(0, n), second = total.substr(n, 2*n); auto firstR = find(all(first), 'R'); ll firstRIndex = firstR - begin(first); ll diff = firstRIndex - count(firstR, end(first), 'W'); if (diff < 0 || diff % 2 != 0) { cout << "NO" << endl; continue; } reverse(all(second)); auto secondW = find(all(second), 'W'); ll secondWIndex = secondW - begin(second); diff = secondWIndex - count(secondW, end(second), 'R'); if (diff < 0 || diff % 2 != 0) { cout << "NO" << endl; continue; } cout << "YES" << endl; } }