t = int(input())

def f():
    n = int(input())
    s = input().strip()
    pos = [[[], []], [[], []]]
    map = []
    for i, char in enumerate(s):
        if char == "W":
            if i < n:
                pos[0][0].append(i)
            else:
                pos[0][1].append(i)
            map.append(0)
        else:
            if i < n:
                pos[1][0].append(i)
            else:
                pos[1][1].append(i)
            map.append(1)
    for i in range(2):
        for j in range(2):
            pos[i][j] = list(reversed(pos[i][j]))

    done = [False for _ in range(2*n)]

    for i in range(n):
        if done[i]:
            continue
        if map[i] == 0:
            pos[0][0].pop()
            if not pos[0][0]:
                print("NO")
                return
            done[pos[0][0].pop()] = True
        else:
            pos[1][0].pop()
            if not pos[0][1]:
                print("NO")
                return
            done[pos[0][1].pop()] = True

    print("YES")

for _ in range(t):
    f()