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.net.Inet4Address;
  import java.util.*;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.util.StringTokenizer;
  
  
  public class practiceb{
  
      static FastScanner sc;
      static int ans;
      static long[] arr,arr1;
      static char[][] board;
      static long mul,mul1;
      static int[] spf;
      static char[] ch;
      static int n,q,m;
      static long k,a,x,c;
      static StringBuilder sb,sb1;
      static long b,sum;
      static Map<Integer,List<Integer>> map;
      static Map<Long,List<Integer>> map2;
      static Map<Long,List<Integer>> map3;
      static Map<Integer,Integer> shortest;
      static Map<Integer,Integer> map1,in;
      static List<Integer> list,list1;
      static long[] count;
      static boolean[] vis;
      static boolean flag;
      static long total,xor1;
  
      // static class Node{
      //     long dist;
      //     Set<Integer> set;
      //     Node(){
      //         this.set = new HashSet<>();
      //     }
      //     Node(int f){
      //         this.dist = f;
      //         this.set = new HashSet<>();
      //     }
      // }
  
      // public static class Lca {
  
      //     int[] depth;
      //     int[] dfs_order;
      //     int cnt;
      //     int[] first;
      //     int[] minPos;
      //     int n;
  
      //     void dfs(List<Integer>[] tree, int u, int d) {
      //         depth[u] = d;
      //         dfs_order[cnt++] = u;
      //         for (int v : tree[u])
      //             if (depth[v] == -1) {
      //                 dfs(tree, v, d + 1);
      //                 dfs_order[cnt++] = u;
      //             }
      //     }
  
      //     void buildTree(int node, int left, int right) {
      //         if (left == right) {
      //             minPos[node] = dfs_order[left];
      //             return;
      //         }
      //         int mid = (left + right) >> 1;
      //         buildTree(2 * node + 1, left, mid);
      //         buildTree(2 * node + 2, mid + 1, right);
      //         minPos[node] = depth[minPos[2 * node + 1]] < depth[minPos[2 * node + 2]] ? minPos[2 * node + 1] : minPos[2 * node + 2];
      //     }
  
      //     public Lca(List<Integer>[] tree, int root) {
      //         int nodes = tree.length;
      //         depth = new int[nodes];
      //         Arrays.fill(depth, -1);
  
      //         n = 2 * nodes - 1;
      //         dfs_order = new int[n];
      //         cnt = 0;
      //         dfs(tree, root, 0);
  
      //         minPos = new int[4 * n];
      //         buildTree(0, 0, n - 1);
  
      //         first = new int[nodes];
      //         Arrays.fill(first, -1);
      //         for (int i = 0; i < dfs_order.length; i++)
      //             if (first[dfs_order[i]] == -1)
      //                 first[dfs_order[i]] = i;
      //     }
  
      //     public int lca(int a, int b) {
      //         return minPos(Math.min(first[a], first[b]), Math.max(first[a], first[b]), 0, 0, n - 1);
      //     }
  
      //     int minPos(int a, int b, int node, int left, int right) {
      //         if (a == left && right == b)
      //             return minPos[node];
      //         int mid = (left + right) >> 1;
      //         if (a <= mid && b > mid) {
      //             int p1 = minPos(a, Math.min(b, mid), 2 * node + 1, left, mid);
      //             int p2 = minPos(Math.max(a, mid + 1), b, 2 * node + 2, mid + 1, right);
      //             return depth[p1] < depth[p2] ? p1 : p2;
      //         } else if (a <= mid) {
      //             return minPos(a, Math.min(b, mid), 2 * node + 1, left, mid);
      //         } else if (b > mid) {
      //             return minPos(Math.max(a, mid + 1), b, 2 * node + 2, mid + 1, right);
      //         } else {
      //             throw new RuntimeException();
      //         }
      //     }
      // }
  
      // private static long dfs(int v, int parent,long ht) {
  
      //     List<Integer> list = map.get(v);
      //     hyt[v] = ht;
  
      //     if(list.size() == 1){
      //         if(!map3.containsKey(ht))
      //             map3.put(ht,new ArrayList<>());
  
      //         map3.get(ht).add(v);
      //         return ht;
  
      //     }
  
      //     long maxl = -1;
      //     for(Integer i : list){
      //         if(i == parent)
      //             continue;
      //         maxl = Math.max(maxl,dfs(i,v,ht+1));
      //     }
  
      //     return maxl;
  
      // }
      // public static int N = 100005;
  
      // long a[N];
      // long sfx[N];
      // long pfx[N];
  
  //    public static boolean f(int width){
  //
  //        // long[] a = new long[n];
  //        long[] sfx = new long[n];
  //        long[] pfx = new long[n];
  
  //        for (int j = 0; j < n; j++){
  //            if (j % width == 0){
  //                pfx[j] = a[j];
  //            }
  //            else pfx[j] = gcd(pfx[j - 1], a[j]);
  //        }
  //        for (int j = n - 2; j >= 0; j--){
  //            if (j % width == width - 1){
  //                sfx[j] = a[j];
  //            }
  //            else sfx[j] = gcd(sfx[j + 1], a[j]);
  //        }
  //
  //        for(int j = 0; j < n - width + 1 ; j++){
  //            if (gcd(sfx[j], pfx[j + width - 1]) >= k) return true;
  //            if (((j % width) == width - 1) && pfx[j] >= k){
  //                return true;
  //            }
  //        }
  //        return false;
  //    }
  
      public static class Node {
          int v;
          int wt;
          Node(int v,int wt) {
              this.v = v;
              this.wt = wt;
          }
      }
  
      public static long lcm(long a, long b) {
          return (b / gcd(b, a % b)) * a;
      }
  
      public static void SpecialSieve(int MAXN) {
          spf = new int[MAXN];
          spf[1] = 1;
          for (int i = 2; i < MAXN; i++)
  
              // marking smallest prime factor for every
              // number to be itself.
              spf[i] = i;
  
          // separately marking spf for every even
          // number as 2
          for (int i = 4; i < MAXN; i += 2)
              spf[i] = 2;
  
          for (int i = 3; i * i < MAXN; i++) {
              // checking if i is prime
              if (spf[i] == i) {
                  // marking SPF for all numbers divisible by i
                  for (int j = i * i; j < MAXN; j += i)
  
                      // marking spf[j] if it is not
                      // previously marked
                      if (spf[j] == j)
                          spf[j] = i;
              }
          }
      }
  
      public static void solve1(List<Integer> list) {
  
          int n = list.size();
          long lcm = arr[list.get(0)];
          for(int i = 1 ; i < n ; i++)
              lcm = lcm(lcm,arr[list.get(i)]);
  
          if(n%2 == 0) {
              for(int i = 0 ; i < n ; i++) {
                  if(i%2 == 0) {
                      count[list.get(i)] = (lcm/arr[list.get(i)]);
                  }
                  else {
                      count[list.get(i)] = (-(lcm/arr[list.get(i)]));
                  }
              }
          }
          else {
              count[list.get(0)] = (lcm/arr[list.get(0)]);
              count[list.get(1)] = (lcm/arr[list.get(1)]);
  
              count[list.get(2)] = (-2*lcm/arr[list.get(2)]);
  
              for(int i = 3 ; i < n ; i++) {
                  if(i%2 == 0) {
                      count[list.get(i)] = (lcm/arr[list.get(i)]);
                  }
                  else {
                      count[list.get(i)] = (-(lcm/arr[list.get(i)]));
                  }
              }
  
          }
      }
  
      public static void solve() {
  
          List<Long> list = new ArrayList<>();
          List<Long> list1 = new ArrayList<>();
  
          for(int i = 0 ; i < n ; i++) {
              if(ch[i] == 'B') {
                  if(arr[i] <= 0) {
                      sb.append("NO").append("\n");
                      return;
                  }
                  list.add(arr[i]);
              }
              else {
                  list1.add(arr[i]);
              }
          }
  
          Collections.sort(list);
          Collections.sort(list1);
  
          for(int i = 0 ; i < list.size() ; i++) {
              if(i != 0 && (list.get(i) <= list.get(i-1))) {
                  sb.append("NO").append("\n");
                  return;
              }
              else
                  list.set(i,i+1L);
          }
  
          if((list.size() > 0 && list1.size() > 0) && (list1.get(0) > (list.get(list.size()-1) + 1))) {
              sb.append("NO").append("\n");
              return;
          }
          if(list.size() == 0 && list1.get(0) > 1) {
              sb.append("NO").append("\n");
              return;
          }
  
          for(int i = 0 ; i < list1.size() ; i++) {
              if(i != 0 && list1.get(i) > (list1.get(i-1)+1)) {
                  sb.append("NO").append("\n");
                  return;
              }
              else
                  list1.set(i,i+1L+list.size());
          }
  
          sb.append("YES").append("\n");
  
      }
  
      public static void main(String[] args) {
  
          sc = new FastScanner();
          // Scanner sc = new Scanner(System.in);
          // SpecialSieve(5000000+5);
  //        long num = 1;
  //        list = new ArrayList<>();
  //        for(int i = 0 ; i <= 60 ; i++) {
  //            list.add(num);
  //            num *= 2;
  //        }
          int t = sc.nextInt();
  //        SpecialSieve(10001);
  //        fact(200000+1);
          sb = new StringBuilder();
  //        int t = 1;
          while(t > 0){
  
  //            a = sc.nextLong();
  //            b = sc.nextLong();
  //            c = sc.nextLong();
              n = sc.nextInt();
              // x = sc.nextLong();
  //             m = sc.nextInt();
  //            k = sc.nextInt();
              // mat = new int[2][m];
  
              // for(int i = 0 ; i < 2 ; i++)
              //     for(int j = 0 ; j < m ; j++)
              //         mat[i][j] = sc.nextLong();
  
              // for(int i = 1 ; i <= 15 ; i++){
              //     m = i;
              //     solve();
              // // }
              // board = new char[3][3];
              // for(int i = 0 ; i < 3 ; i++){
              //     String s = sc.next();
              //     for(int j = 0 ; j < 3 ; j++){
              //         board[i][j] = s.charAt(j);
              //     }
              // }
              // x = sc.nextInt();
  //             ch = sc.next().toCharArray();
              // q = sc.nextInt();
  //             ch = sc.next().toCharArray();
              arr = new long[n];
              for(int i = 0 ; i < n ; i++)
                  arr[i] = sc.nextLong();
  
              ch = sc.next().toCharArray();
  
  //            arr1 = new long[m];
  //            for(int i = 0 ; i < m ; i++)
  //                arr1[i] = sc.nextLong();
  //
  //            a = new long[n-1];
  //            for(int i = 1 ; i < n ; i++)
  //                a[i-1] = Math.abs(arr[i] - arr[i-1]);
  //
  //            n -= 1;
  
              solve();
              t -= 1;
          }
          System.out.print(sb);
  
      }
  
      // Use this instead of Arrays.sort() on an array of ints. Arrays.sort() is n^2
      // worst case since it uses a version of quicksort. Although this would never
      // actually show up in the real world, in codeforces, people can hack, so
      // this is needed.
      static void ruffleSort(long[] a) {
          //ruffle
          int n=a.length;
          Random r=new Random();
          for (int i=0; i<a.length; i++) {
              int oi=r.nextInt(n);long temp=a[i];
              a[i]=a[oi];
              a[oi]=temp;
          }
  
          //then sort
          Arrays.sort(a);
      }
      public static long gcd(long a, long b)
      {
          if (b == 0)
              return a;
  
          return gcd(b, a % b);
  
      }
      public static int log(double n,double base){
  
          if(n == 0 || n == 1)
              return 0;
  
          if(n == base)
              return 1;
  
          double num = Math.log(n);
          double den = Math.log(base);
  
          if(den == 0)
              return 0;
  
          return (int)(num/den);
      }
      public static long mod(long x, long mod)
      {
          long result = x % mod;
          if (result < 0)
          {
              result += mod;
          }
          return result;
      }
  
      // Use this to input code since it is faster than a Scanner
      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());
          }
      }
  }
  