#include<cstdio> using namespace std; const int N = 1010; int n; char s[N]; void solve() { scanf("%d", &n); scanf("%s", s+1); bool inorder = 1; int first_r, last_w; for (int i = 1; i <= n; i++) { if (s[i] == 'R') { first_r = i; inorder = 0; break; } } if (inorder) { if (n % 2 == 1) { printf("NO\n"); } else { printf("YES\n"); } return; } for (int i = 2 * n; i >= n + 1; i--) { if (s[i] == 'W') { last_w = i; break; } } int s1 = 0, s2 = 0, s3 = 0, s4 = 0; for (int i = 1; i <= first_r; i++) { if (s[i] == 'W') { s1++; } } for (int i = first_r; i <= n; i++) { if (s[i] == 'W') { s2++; } } if (s1 < s2 || (s1 + s2) % 2 == 1) { printf("NO\n"); return; } for (int i = last_w; i <= 2 * n; i++) { if (s[i] == 'R') { s3++; } } for (int i = n + 1; i <= last_w; i++) { if (s[i] == 'R') { s4++; } } if (s3 < s4 || (s3 + s4) % 2 == 1) { printf("NO\n"); return; } printf("YES\n"); } int main() { int t; scanf("%d", &t); while(t--) { solve(); } return 0; }