from itertools import izip
def solution():
_ = input()
return "YES" if all((x[0] == 'B' and x[1] >= i+1) or (x[0] == 'R' and x[1] <= i+1) for i, x in enumerate(sorted((c, x) for x, c in izip(map(int, raw_input().split()), raw_input())))) else "NO"
for case in xrange(input()):
print '%s' % solution()