description: You are given an array of integers a of length n. The elements of the array can be either different or the same. 
  
  Each element of the array is colored either blue or red. There are no unpainted elements in the array. One of the two operations described below can be applied to an array in a single step:
  
    * either you can select any blue element and decrease its value by 1; 
    * or you can select any red element and increase its value by 1. 
  
  
  
  Situations in which there are no elements of some color at all are also possible. For example, if the whole array is colored blue or red, one of the operations becomes unavailable.
  
  Determine whether it is possible to make 0 or more steps such that the resulting array is a permutation of numbers from 1 to n?
  
  In other words, check whether there exists a sequence of steps (possibly empty) such that after applying it, the array a contains in some order all numbers from 1 to n (inclusive), each exactly once.
  
  Input
  
  The first line contains an integer t (1 ≤ t ≤ 10^4) — the number of input data sets in the test.
  
  The description of each set of input data consists of three lines. The first line contains an integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the length of the original array a. The second line contains n integers a_1, a_2, ..., a_n (-10^9 ≤ a_i ≤ 10^9) — the array elements themselves.
  
  The third line has length n and consists exclusively of the letters 'B' and/or 'R': ith character is 'B' if a_i is colored blue, and is 'R' if colored red.
  
  It is guaranteed that the sum of n over all input sets does not exceed 2 ⋅ 10^5.
  
  Output
  
  Print t lines, each of which contains the answer to the corresponding test case of the input. Print YES as an answer if the corresponding array can be transformed into a permutation, and NO otherwise.
  
  You can print the answer in any case (for example, the strings yEs, yes, Yes, and YES will be recognized as a positive answer).
  
  Example
  
  Input
  
  
  8
  4
  1 2 5 2
  BRBR
  2
  1 1
  BB
  5
  3 1 4 2 5
  RBRRB
  5
  3 1 3 1 3
  RBRRB
  5
  5 1 5 1 5
  RBRRB
  4
  2 2 2 2
  BRBR
  2
  1 -2
  BR
  4
  -2 -1 4 0
  RRRR
  
  
  Output
  
  
  YES
  NO
  YES
  YES
  NO
  YES
  YES
  YES
  
  Note
  
  In the first test case of the example, the following sequence of moves can be performed:
  
    * choose i=3, element a_3=5 is blue, so we decrease it, we get a=[1,2,4,2]; 
    * choose i=2, element a_2=2 is red, so we increase it, we get a=[1,3,4,2]; 
    * choose i=3, element a_3=4 is blue, so we decrease it, we get a=[1,3,3,2]; 
    * choose i=2, element a_2=2 is red, so we increase it, we get a=[1,4,3,2]. 
  
  
  
  We got that a is a permutation. Hence the answer is YES.
solution: import sys
  import time
  import os
  from io import BytesIO, IOBase
  import math
  from random import randint
  
  M=10**9+7
  BUFSIZE = 8192
  class FastIO(IOBase):
      newlines = 0
   
      def __init__(self, file):
          self._fd = file.fileno()
          self.buffer = BytesIO()
          self.writable = "x" in file.mode or "r" not in file.mode
          self.write = self.buffer.write if self.writable else None
   
      def read(self):
          while True:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              if not b:
                  break
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines = 0
          return self.buffer.read()
   
      def readline(self):
          while self.newlines == 0:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              self.newlines = b.count(b"\n") + (not b)
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines -= 1
          return self.buffer.readline()
   
      def flush(self):
          if self.writable:
              os.write(self._fd, self.buffer.getvalue())
              self.buffer.truncate(0), self.buffer.seek(0)
   
   
  class IOWrapper(IOBase):
      def __init__(self, file):
          self.buffer = FastIO(file)
          self.flush = self.buffer.flush
          self.writable = self.buffer.writable
          self.write = lambda s: self.buffer.write(s.encode("ascii"))
          self.read = lambda: self.buffer.read().decode("ascii")
          self.readline = lambda: self.buffer.readline().decode("ascii")
   
   
  def print(*args, **kwargs):
      """Prints the values to a stream, or to sys.stdout by default."""
      sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
      at_start = True
      for x in args:
          if not at_start:
              file.write(sep)
          file.write(str(x))
          at_start = False
      file.write(kwargs.pop("end", "\n"))
      if kwargs.pop("flush", False):
          file.flush()
   
   
  if sys.version_info[0] < 3:
      sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
  else:
      sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
  input = lambda: sys.stdin.readline().rstrip("\r\n")
   
  def inputf(): 
      return sys.stdin.readline().rstrip("\r\n")   
   
  def get_ints(): 
      return list(map(int, inputf().split()))
   
   
  def get_string(): 
      return list(map(str, inputf().split()))
  
  
  
  
  
  global maximum
   
   
  def _lis(arr, n):
   
      global maximum
   
      if n == 1:
          return 1
   
      maxEndingHere = 1
      for i in range(1, n):
          res = _lis(arr, i)
          if arr[i-1] < arr[n-1] and res+1 > maxEndingHere:
              maxEndingHere = res + 1
   
      maximum = max(maximum, maxEndingHere)
   
      return maxEndingHere
   
   
  def LIS(arr):
   
      global maximum
   
      n = len(arr)
   
      maximum = 1
   
      _lis(arr, n)
   
      return maximum
   
  
  def binary_search(data, elem):
      
      low = 0
      high = len(data) - 1
      while low <= high:
        
          middle = (low + high)//2
          if data[middle] == elem:
              return middle
              
          elif data[middle] > elem:
  
              high = middle - 1
          else:
              low = middle + 1
  
      return middle   
  
  def upper_bound(my_list, key):
      large = len(my_list) -1
      small = 0
  
      while (small <= large):
          mid = (small + large) // 2
          if my_list[mid] < key:
              small = mid + 1
          elif my_list[mid] > key:
              large = mid - 1
          else:
              return mid
      if my_list[mid]>key:
          return mid
      else:
          return mid+1
  
  
  def lower_bound(my_list, key):
      large = len(my_list) -1
      small = 0
  
      while (small <= large):
          mid = (small + large) // 2
          if my_list[mid] < key:
              small = mid + 1
          elif my_list[mid] > key:
              large = mid - 1
          else:
              return mid
      if my_list[mid]<key:
          return mid
      else:
          return mid-1
  
  
  a=[]
  def SieveOfEratosthenes(n):
      
  	prime = [True for i in range(n+1)]
  	p = 2
  	while (p * p <= n):
  
  		if (prime[p] == True):
  
  			for i in range(p * p, n+1, p):
  				prime[i] = False
  		p += 1
  
  	for p in range(2, n+1):
  		if prime[p]:
  			a.append(p)
  
  def roman_number(x):
      if x > 15999:
          return
      value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
      symbol = ["F", "MF", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
      roman = ""
      i = 0
      while x > 0:
          div = x // value[i]
          x = x % value[i]
          while div:
              roman += symbol[i]
              div -= 1
          i += 1
      return roman
  
  def maxSubArraySum(a,size):
       
      max_so_far = a[0]   
      max_ending_here = 0
       
      for i in range(0, size):
          max_ending_here = max_ending_here + a[i]
          if max_ending_here < 0:
              max_ending_here = 0
           
          elif (max_so_far < max_ending_here):   
              max_so_far = max_ending_here
               
      return max_so_far
  
      
  def prefixSum(test_list):
      res = [sum(test_list[ : i + 1]) for i in range(len(test_list))]
      return res
  
  # Python Program to find the L.C.M. of two input number
  
  def lcm(x, y):
  
     # choose the greater number
     if x > y:
         greater = x
     else:
         greater = y
  
     while(True):
         if((greater % x == 0) and (greater % y == 0)):
             lcm = greater
             break
         greater += 1
  
     return lcm
  """
  def find_shortest_path(graph, start, end, path):
      path = path + [start]
      if start == end:
          return path
      if start not in graph:
          return None
      shortest = None
      for node in graph[start]:
          if node not in path:
              newpath = find_shortest_path(graph, node, end, path)
              if newpath:
                  if not shortest or len(newpath) < len(shortest):
                      shortest = newpath
      return shortest
  """ 
  
  """
  def dfs(root,nodeVal,nodeConnection,visited):
      leftVal = nodeVal[root][0]
      rightVal = nodeVal[root][1]
      solution = []
      if nodeConnection[root]:
          visited.add(root)
          for i in nodeConnection[root]:
              if i not in visited:
                  solution.append(dfs(i,nodeVal,nodeConnection,visited))
          leftMax = 0
          rightMax = 0
          for i in solution:
              l, r = i
              leftMax += max(abs(leftVal - l[0]) + l[1], abs(leftVal - r[0]) + r[1])
              rightMax += max(abs(rightVal - l[0]) + l[1], abs(rightVal - r[0]) + r[1])
          return ((leftVal, leftMax), (rightVal, rightMax))
      else:
          return ((leftVal, 0), (rightVal, 0))
   
  """
   
  """
  def BFS(adj,src,dist,paths,n):
      visited=[False]*n
      dist[src]=0
      paths[0]=1
      q=[src]
      visited[src]=True
      while(q):
          p=q.pop(0)
          for j in adj[p]:
              if not visited[j]:
                  q.append(j)
                  visited[j]=True
              if dist[j]>dist[p]+1:
                  dist[j] = dist[p]+1
                  paths[j] = paths[p]
              elif dist[j]==dist[p]+1:
                  paths[j] +=paths[p]
      return paths
   
  """
  
  testcase=int(inputf())
  
  for test in range(testcase):
      n=int(inputf())
      a=get_ints()
      color=inputf()
  
      blue=[]
      red=[]
  
      for i in range(0,n):
          if color[i]=="R":
              red.append(a[i])
          else:
              blue.append(a[i])
      
      blue.sort()
      red.sort(reverse=True)
  
  
      left=1
      right=n
  
      stop=False
      for num in blue:
          if num>=left:
              left+=1
          else:
              print("NO")
  
              stop=True
              break
      
      if stop==False:
          for num in red:
              if num<=right:
                  right-=1
              else:
                  print("NO")
                  break
          else:
              print("YES")
  
  