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