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 java.io.*;
  import java.util.*;
  
  
  public class Practice
  {
  //	static final long mod=7420738134811L;
  	static int mod=1000000007;
  	static final int size=501;
  	static FastReader sc=new FastReader(System.in);
  //	static Reader sc=new Reader();
  	static  PrintWriter out=new PrintWriter(System.out);
  	static long[] factorialNumInverse;
  	static long[] naturalNumInverse;	
  	static int[] sp;
  	static long[] fact;
  	static ArrayList<Integer> pr;
  	public static void main(String[] args) throws IOException
  	{
  //		System.setIn(new FileInputStream("input.txt"));
  //		System.setOut(new PrintStream("output.txt"));
  //		factorial(mod);
  //		InverseofNumber(mod);
  //		InverseofFactorial(mod);
  //		make_seive();
  		int t=1;
  		t=sc.nextInt();
  		while(t-->0)
  			solve();
  		out.close();
  		out.flush();
  	}
  	static void solve() throws IOException
  	{
  		int n=sc.nextInt();
  		int arr[]=new int[n];
  		for(int i=0;i<n;i++)
  			arr[i]=sc.nextInt();
  		String s=sc.next();
  		ArrayList<Integer> blue=new ArrayList<Integer>();
  		ArrayList<Integer> red=new ArrayList<Integer>();
  		for(int i=0;i<n;i++)
  		{
  			if(s.charAt(i)=='B')
  				blue.add(arr[i]);
  			else
  				red.add(arr[i]);
  		}
  		Collections.sort(blue);
  		Collections.sort(red);
  		for(int i=0;i<blue.size();i++)
  		{
  			if(blue.get(i)<i+1)
  			{
  				out.println("NO");
  				return;
  			}
  		}
  		for(int i=0;i<red.size();i++)
  		{
  			if(red.get(i)>i+1+blue.size())
  			{
  				out.println("NO");
  				return;
  			}
  		}
  		out.println("YES");
  	}
  	static class Pair implements Cloneable, Comparable<Pair>
  	{
  		int x,y;
  		Pair(int a,int b)
  		{
  			this.x=a;
  			this.y=b;
  		}
  		@Override
  		public boolean equals(Object obj) 
  		{
  			if(obj instanceof  Pair)
  			{
  				Pair p=(Pair)obj;
  				return p.x==this.x && p.y==this.y;
  			}
  			return false;
  		}
  		@Override
  		public int hashCode() 
  		{
  			return Math.abs(x)+500*Math.abs(y);
  		}
  		@Override
  		public String toString() 
  		{
  			return "("+x+" "+y+")";
  		}
  		@Override
  		protected Pair clone() throws CloneNotSupportedException {
  			return new Pair(this.x,this.y);
  		}
  		@Override
  		public int compareTo(Pair a) 
  		{
  			int t= this.x-a.x;
  			if(t!=0)
  				return t;
  			else
  				return this.y-a.y;
  		}
  		public void swap()
  		{
  			this.y=this.y+this.x;
  			this.x=this.y-this.x;
  			this.y=this.y-this.x;			
  		}
  	}
  	static class Tuple implements Cloneable, Comparable<Tuple>
  	{
  		int x,y,z;
  		Tuple(int a,int b,int c)
  		{
  			this.x=a;
  			this.y=b;
  			this.z=c;
  		}
  		public boolean equals(Object obj) 
  		{
  			if(obj instanceof  Tuple)
  			{
  				Tuple p=(Tuple)obj;
  				return p.x==this.x && p.y==this.y && p.z==this.z;
  			}
  			return false;
  		}
  		@Override
  		public int hashCode() 
  		{
  			return (this.x+501*this.y);
  		}
  		@Override
  		public String toString() 
  		{
  			return "("+x+","+y+","+z+")";
  		}
  		@Override
  		protected Tuple clone() throws CloneNotSupportedException {
  			return new Tuple(this.x,this.y,this.z);
  		}
  		@Override
  		public int compareTo(Tuple a) 
  		{
  			int x=this.z-a.z;
  			if(x!=0)
  				return x;
  			int X= this.x-a.x;
  			if(X!=0)
  				return X;
  			return a.y-this.y;
  		}
  	}
  	static void arraySort(int arr[])
  	{
  		ArrayList<Integer> a=new ArrayList<Integer>();
  		for (int i = 0; i < arr.length; i++) {
  			a.add(arr[i]);
  		}
  		Collections.sort(a);
  		for (int i = 0; i < arr.length; i++) {
  			arr[i]=a.get(i);
  		}
  	}
  	static void arraySort(long arr[])
  	{
  		ArrayList<Long> a=new ArrayList<Long>();
  		for (int i = 0; i < arr.length; i++) {
  			a.add(arr[i]);
  		}
  		Collections.sort(a);
  		for (int i = 0; i < arr.length; i++) {
  			arr[i]=a.get(i);
  		}
  	}
  	static HashSet<Integer> primeFactors(int n)
  	{
  		HashSet<Integer> ans=new HashSet<Integer>();
  		if(n%2==0)
  		{
  			ans.add(2);
  			while((n&1)==0)
  				n=n>>1;
  		}
  		for(int i=3;i*i<=n;i+=2)
  		{
  			if(n%i==0)
  			{
  				ans.add(i);
  				while(n%i==0)
  					n=n/i;
  			}
  		}
  		if(n!=1)
  			ans.add(n);
  		return ans;
  	}
  	static void make_seive()
  	{
  		sp=new int[size];
  		pr=new ArrayList<Integer>();
  		for (int i=2; i<size; ++i) {
  		    if (sp[i] == 0) {
  		        sp[i] = i;
  		        pr.add(i);
  		    }
  		    for (int j=0; j<(int)pr.size() && pr.get(j)<=sp[i] && i*pr.get(j)<size; ++j)
  		        sp[i * pr.get(j)] = pr.get(j);
  		}
  	}
  	public static void InverseofNumber(int p)
  	{
  		naturalNumInverse=new long[size];
  	    naturalNumInverse[0] = naturalNumInverse[1] = 1;
  	    for(int i = 2; i < size; i++)
  	        naturalNumInverse[i] = naturalNumInverse[p % i] * (long)(p - p / i) % p;
  	}
  	// Function to precompute inverse of factorials
  	public static void InverseofFactorial(int p)
  	{
  		factorialNumInverse=new long[size];
  	    factorialNumInverse[0] = factorialNumInverse[1] = 1;
  	    // pre-compute inverse of natural numbers
  	    for(int i = 2; i < size; i++)
  	        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
  	}
  	// Function to calculate factorial of 1 to 200001
  	public static void factorial(int p)
  	{
  		fact=new long[size];
  	    fact[0] = 1;
  	    for(int i = 1; i < size; i++)
  	        fact[i] = (fact[i - 1] * (long)i) % p;
  	}
  	 
  	// Function to return nCr % p in O(1) time
  	public static long Binomial(int N, int R)
  	{
  		if(R<0)
  			return 1;
  	    // n C r = n!*inverse(r!)*inverse((n-r)!)
  	    long ans = ((fact[N] * factorialNumInverse[R]) % mod * factorialNumInverse[N - R]) % mod;
  	    return ans;
  	}
  	static int findXOR(int x)	//from 0 to x
  	{
  		if(x<0)
  			return 0;
  		if(x%4==0)
  			return x;
  		if(x%4==1)
  			return 1;
  		if(x%4==2)
  			return x+1;
  		return 0;
  	}
  	static boolean isPrime(long x)
  	{
  		if(x==1)
  			return false;
  		if(x<=3)
  			return true;
  		if(x%2==0 || x%3==0)
  			return false;
  		for(int i=5;i<=Math.sqrt(x);i+=2)
  			if(x%i==0)
  				return false;
  		return true;
  	}
  	static long gcd(long a,long b)
  	{
  		return (b==0)?a:gcd(b,a%b);
  	}
  	static int gcd(int a,int b)
  	{
  		return (b==0)?a:gcd(b,a%b);
  	}
  	static class Node
  	{
  		int vertex;
  		HashSet<Edge> adj;
  		int taxC,taxD;
  		Node(int ver)
  		{
  			vertex=ver;
  			taxD=0;
  			taxC=0;
  			adj=new HashSet<Edge>();
  		}
  		@Override
  		public String toString() 
  		{
  			return vertex+" ";
  		}
  	}
  	static class Edge
  	{
  		Node to;
  		int cost;
  		Edge(Node t,int c)
  		{
  			this.to=t;
  			this.cost=c;
  		}
  		@Override
  		public String toString() {
  			return "("+to.vertex+","+cost+") ";
  		}
  	}
  	static long power(long x, long y)
  	  {
  		if(x<=0)
  			return 1;
  	    long res = 1; 
  	    x = x % mod; 
  	    if (x == 0)
  	      return 0; 
  	    while (y > 0)
  	    {
  	    	if ((y & 1) != 0)
  	    		res = (res * x) % mod;
  	    	
  	    	y = y >> 1; // y = y/2
  	    	x = (x * x) % mod;
  	    }
  	    return res;
  	  }
  	static long binomialCoeff(long n, long k)
      {
  		if(n<k)
  			return 0;
          long res = 1;
  //        if(k>n)
  //        	return 0;
          // Since C(n, k) = C(n, n-k)
          if (k > n - k)
              k = n - k;
   
          // Calculate value of
          // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
          for (long i = 0; i < k; ++i) {
              res *= (n - i);
              res /= (i + 1);
          }
   
          return res;
      }
  	static class FastReader
  	{
          byte[] buf = new byte[2048];
          int index, total;
          InputStream in;
   
          FastReader(InputStream is) 
          {
              in = is;
          }
   
          int scan() throws IOException 
          {
              if (index >= total) {
                  index = 0;
                  total = in.read(buf);
                  if (total <= 0) {
                      return -1;
                  }
              }
              return buf[index++];
          }
   
          String next() throws IOException 
          {
              int c;
              for (c = scan(); c <= 32; c = scan());
              StringBuilder sb = new StringBuilder();
              for (; c > 32; c = scan()) {
                  sb.append((char) c);
              }
              return sb.toString();
          }
   
          int nextInt() throws IOException 
          {
              int c, val = 0;
              for (c = scan(); c <= 32; c = scan());
              boolean neg = c == '-';
              if (c == '-' || c == '+') {
                  c = scan();
              }
              for (; c >= '0' && c <= '9'; c = scan()) {
                  val = (val << 3) + (val << 1) + (c & 15);
              }
              return neg ? -val : val;
          }
   
          long nextLong() throws IOException 
          {
              int c;
              long val = 0;
              for (c = scan(); c <= 32; c = scan());
              boolean neg = c == '-';
              if (c == '-' || c == '+') {
                  c = scan();
              }
              for (; c >= '0' && c <= '9'; c = scan()) {
                  val = (val << 3) + (val << 1) + (c & 15);
              }
              return neg ? -val : val;
          }
      }
  	static class Reader 
  	{
          final private int BUFFER_SIZE = 1 << 16;
          private DataInputStream din;
          private byte[] buffer;
          private int bufferPointer, bytesRead;
   
          public Reader()
          {
              din = new DataInputStream(System.in);
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
   
          public Reader(String file_name) throws IOException
          {
              din = new DataInputStream(
                  new FileInputStream(file_name));
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
   
          public String readLine() throws IOException
          {
              byte[] buf = new byte[64]; // line length
              int cnt = 0, c;
              while ((c = read()) != -1) {
                  if (c == '\n') {
                      if (cnt != 0) {
                          break;
                      }
                      else {
                          continue;
                      }
                  }
                  buf[cnt++] = (byte)c;
              }
              return new String(buf, 0, cnt);
          }
   
          public int nextInt() throws IOException
          {
              int ret = 0;
              byte c = read();
              while (c <= ' ') {
                  c = read();
              }
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
   
              if (neg)
                  return -ret;
              return ret;
          }
   
          public long nextLong() throws IOException
          {
              long ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
              if (neg)
                  return -ret;
              return ret;
          }
   
          public double nextDouble() throws IOException
          {
              double ret = 0, div = 1;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
   
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
   
              if (c == '.') {
                  while ((c = read()) >= '0' && c <= '9') {
                      ret += (c - '0') / (div *= 10);
                  }
              }
   
              if (neg)
                  return -ret;
              return ret;
          }
   
          private void fillBuffer() throws IOException
          {
              bytesRead = din.read(buffer, bufferPointer = 0,
                                   BUFFER_SIZE);
              if (bytesRead == -1)
                  buffer[0] = -1;
          }
   
          private byte read() throws IOException
          {
              if (bufferPointer == bytesRead)
                  fillBuffer();
              return buffer[bufferPointer++];
          }
   
          public void close() throws IOException
          {
              if (din == null)
                  return;
              din.close();
          }
          public void printarray(int arr[])
          {
          	for (int i = 0; i < arr.length; i++)
  				System.out.print(arr[i]+" ");
          	System.out.println();
          }
      }
  }
  
  
  
  
  
  
  
  