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: //package Codeforces;
  import java.util.*;
  
  import java.io.*;
  public  class template{
  	
  	static class FastScanner {
  		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  		StringTokenizer st = new StringTokenizer("");
  		String next () {
  			while(!st.hasMoreTokens()) {
  				try {
  					st=new StringTokenizer(br.readLine());
  				}catch(IOException e) {
  					e.printStackTrace();
  				}
  			}
  			return st.nextToken();
  		}
  		
  		int nextInt() {
  			return Integer.parseInt(next());
  		}
  		
  		int[] readArray(int n) {
  			int a[] = new int[n];
  			for(int i=0;i<n;i++) {
  				a[i] = nextInt();
  			}
  			return a;
  		}
  		
  		long nextLong() {
  			return Long.parseLong(next());
  		}
  	}
  	
  	static class helper{
  		
  		//reverse 1-d Array
  		public static void reverse(int arr[]) {
  			int i = 0;
  			int j = arr.length - 1;
  			while(i<j) {
  				int temp = arr[i];
  				arr[i] = arr[j];
  				arr[j] = temp;
  			}
  		}
  		
  		//gcd of two numbers
  		public static int gcd(int a,int b) {
  			if(b == 0) {
  				return a;
  			}
  			return gcd(b,a%b);
  		}
  		
  		//calculate ncr
  		public static int ncr(int n,int r) {
  			int num = n;
  			int deno = r;
  			int a1 = 1;
  			int a2 = 1;
  			for(int i=0;i<r;i++) {
  				a1 *= num;
  				a2 *= deno;
  				num--;
  				deno--;
  			}
  			int ans = a1/a2;
  			return ans;
  		}
  		
  		//isPalindrome
  		public static boolean isPalindrome(String substring){
  		    char ch[] = substring.toCharArray();
  		    int i = 0;
  		    int j = ch.length-1;
  		    while(i<j){
  		        char temp = ch[i];
  		        ch[i] = ch[j];
  		        ch[j] = temp;
  		        i++;
  		        j--;
  		    }
  		    String rev = String.valueOf(ch);
  		    if(rev.equals(substring)){
  		        return true;
  		    }
  		    else{
  		        return false;
  		    }
  		}
  		
  		//isPowerOfTwo
  		public static boolean isPowerOfTwo(long x)
  	    {
  	        /* First x in the below expression is
  	        for the case when x is 0 */
  	        return x != 0 && ((x & (x - 1)) == 0);
  	    }
  		
  		//nextPowerOfTwo
  		public static long nextPowerOfTwo(long n)
  	    {
  	        n--;
  	        n |= n >> 1;
  	        n |= n >> 2;
  	        n |= n >> 4;
  	        n |= n >> 8;
  	        n |= n >> 16;
  	        n++;
  	         
  	        return n;
  	    }
  	}
  	
  
  	
  	public static void main(String[] args) {
  		  FastScanner sc = new FastScanner();
  		  PrintWriter out = new PrintWriter(System.out);
  		  helper help = new helper();
  		  long test = sc.nextLong();
  		  while(test-->0) {
  			int n = sc.nextInt();
  			int arr[] = sc.readArray(n);
  			String s = sc.next();
  			PriorityQueue<lavesh> pq = new PriorityQueue<>(Comparator.comparing(lavesh::getColor).thenComparing(lavesh::getValue));
              for(int i=0;i<arr.length;i++) {
              	int value = arr[i];
              	String ss = "";
              	ss += s.charAt(i);
              	pq.add(new lavesh(value,ss));
              }
              int index= 1;
              boolean flag = true;
              while(pq.size() != 0) {
              	lavesh e = pq.peek();
              	if(e.value == index) {
              		
              	}
              	else if(e.value < index && e.color.equals("R")) {
              		
              	}
              	else if(e.value > index && e.color.equals("B")) {
              		
              	}
              	else {
              		flag = false;
              		break;
              	}
              	index++;
              	pq.poll();
              }
              if(flag) {
              	out.println("YES");
              }
              else {
              	out.println("NO");
              }
  		  }
  		  out.flush();
  	}
  	
  }
  class lavesh {
  	int value;
  	String color;
  	lavesh(int value,String color){
  		this.value = value;
  		this.color = color;
  	}
  	public int getValue() {
  		return value;
  	}
  	public void setValue(int value) {
  		this.value = value;
  	}
  	public String getColor() {
  		return color;
  	}
  	public void setColor(String color) {
  		this.color = color;
  	}
  }
  class pair {
  	int value;
  	int index;
  	pair(int value,int index){
  		this.value = value;
  		this.index = index;
  	}
  	public int getValue() {
  		return value;
  	}
  	public void setValue(int value) {
  		this.value = value;
  	}
  	public int getIndex() {
  		return index;
  	}
  	public void setIndex(int index) {
  		this.index = index;
  	}
  }
  