Ashish has n elements arranged in a line. 

These elements are represented by two integers a_i — the value of the element and b_i — the type of the element (there are only two possible types: 0 and 1). He wants to sort the elements in non-decreasing values of a_i.

He can perform the following operation any number of times: 

  * Select any two elements i and j such that b_i ≠ b_j and swap them. That is, he can only swap two elements of different types in one move. 



Tell him if he can sort the elements in non-decreasing values of a_i after performing any number of operations.

Input

The first line contains one integer t (1 ≤ t ≤ 100) — the number of test cases. The description of the test cases follows.

The first line of each test case contains one integer n (1 ≤ n ≤ 500) — the size of the arrays.

The second line contains n integers a_i (1 ≤ a_i ≤ 10^5) — the value of the i-th element.

The third line containts n integers b_i (b_i ∈ \{0, 1\}) — the type of the i-th element.

Output

For each test case, print "Yes" or "No" (without quotes) depending on whether it is possible to sort elements in non-decreasing order of their value.

You may print each letter in any case (upper or lower).

Example

Input


5
4
10 20 20 30
0 1 0 1
3
3 1 2
0 1 1
4
2 2 4 8
1 1 1 1
3
5 15 4
0 0 0
4
20 10 100 50
1 0 0 1


Output


Yes
Yes
Yes
No
Yes

Note

For the first case: The elements are already in sorted order.

For the second case: Ashish may first swap elements at positions 1 and 2, then swap elements at positions 2 and 3.

For the third case: The elements are already in sorted order.

For the fourth case: No swap operations may be performed as there is no pair of elements i and j such that b_i ≠ b_j. The elements cannot be sorted.

For the fifth case: Ashish may swap elements at positions 3 and 4, then elements at positions 1 and 2.
import java.io.*;
import java.io.IOException;

import java.util.*;
//import javafx.util.Pair; 
//import java.util.concurrent.LinkedBlockingDeque;

//import sun.net.www.content.audio.wav;



    
   public  class Codeforces {
        
        public static long mod = (long)Math.pow(10, 9)+7 ;
        public static double epsilon=0.00000000008854;//value of epsilon
        public static InputReader sc = new InputReader(System.in);
        public static PrintWriter pw = new PrintWriter(System.out);
        public static int firstNode(int a,HashMap<Integer,Integer> p){
            if(p.containsKey(a)){
                p.put(a, firstNode(p.get(a), p));
            }
            else return a;
            return p.get(a);
        }
        public static void Union(int a,int b,HashMap<Integer,Integer> p){
            //int a=firstNode(a1, p);
            //int b=firstNode(b1, p);
            /*if(a!=b){
                if(r[a]<r[b]){
                    p[a]=b;
                }
                else if(r[a]>r[b]){
                    p[b]=a;
                }
                else{
                    r[b]++;
                    p[a]=b;
                }
            }*/
            a=firstNode(a, p);
            b=firstNode(b, p);
            if(a!=b)
            p.put(a, b);//if no rank than 
        }
        public static double getvalue(double beta[],double f1[],double f2[],double y[],int i){
            Double ans=beta[0]+beta[1]*f1[i]+beta[2]*f2[i]-y[i];
            return ans;
        }
        public static int values(int x[],int y[],int cx[],int cy[],int i,int j){
            return (x[i]-cx[j])*(x[i]-cx[j])+(y[i]-cy[j])*(y[i]-cy[j]);
        }
        public static int dp(String s,String t,int i,int d[],int a[],int b[]){
            if(i>=s.length())
            return 0;
            if(d[i]>=0){
                return d[i];
            }
            int c=0;
            if(a[i]==1){
                int k=t.length()-1;
                while(k>=0){
                    c=Math.max(1+dp(s, t, i+t.length()-b[k], d, a, b),c);
                    k=b[k]-1;
                }
               //return d[i]=Math.max(dp(s, t, i+1, d, a, b),c);

            }
            return d[i]=Math.max(dp(s, t, i+1, d, a, b),c);
        }
        public static int[] GetLps(int s[]){
            int n=s.length;
            int a[]=new int[n];
            int j=0;
            for(int i=1;i<n;i++){
                if(s[i]==s[j]){
                    j++;
                    a[i]=j;
                }
                else if(j>0){
                    while(j>0&&s[i]!=s[j]){
                        j=a[--j];
                    }
                    if(s[i]==s[j])
                    a[i]=++j;
                }
            }
            //pw.println(Arrays.toString(a));
    
            return a;
    
        }
        public static int[] GetLps(String s){
            int n=s.length();
            int a[]=new int[n];
            int j=0;
            for(int i=1;i<n;i++){
                if(s.charAt(i)==s.charAt(j)){
                    j++;
                    a[i]=j;
                }
                else if(j>0){
                    while(j>0&&s.charAt(i)!=s.charAt(j)){
                        j=a[--j];
                    }
                    if(s.charAt(i)==s.charAt(j))
                    a[i]=++j;
                }
            }
            //pw.println(Arrays.toString(a));
    
            return a;
    
        }
       
        public static void main(String[] args) {
            // code starts..
            int q=sc.nextInt();
            while(q-->0){
                int n=sc.nextInt();
                int a[]=scanArray(n);
                int b[]=scanArray(n);
                int a1=0,a0=0;
                for(int i=0;i<n;i++){
                    if(b[i]==1)
                    a1=1;
                    else a0=1;
                }
                if(a1==1&&a0==1){
                    pw.println("Yes");
                }
                else{
                    int c[]=a.clone();
                    Arrays.sort(c);
                    int f=0;
                    for(int i=0;i<n;i++){
                        if(c[i]!=a[i]){
                            f=1;
                            break;
                        }
                    }
                    if(f==0){
                        pw.println("Yes");
                    }
                    else pw.println("No");
                }
            }
            // Code ends...
            pw.flush();
            pw.close();
        }
       
        
        public static String reverseString(String s){
            StringBuilder input1 = new StringBuilder(); 
            input1.append(s);  
            input1 = input1.reverse();
            return input1.toString();
        }
        public static int[] scanArray(int n){
            int a[]=new int [n];
            for(int i=0;i<n;i++)
            a[i]=sc.nextInt();
    
            return a;
        }
        public static long[] scanLongArray(int n){
            long a[]=new long [n];
            for(int i=0;i<n;i++)
            a[i]=sc.nextLong();
    
            return a;
        }
        public static String [] scanStrings(int n){
            String a[]=new String [n];
            for(int i=0;i<n;i++)
            a[i]=sc.nextLine();
    
            return a;
        }
        
    }
    
    class InputReader {
    
            private final InputStream stream;
            private final byte[] buf = new byte[8192];
            private int curChar, snumChars;
            private SpaceCharFilter filter;
    
            public InputReader(InputStream stream) {
                this.stream = stream;
            }
    
            public int snext() {
                if (snumChars == -1)
                    throw new InputMismatchException();
                if (curChar >= snumChars) {
                    curChar = 0;
                    try {
                        snumChars = stream.read(buf);
                    } catch (IOException e) {
                        throw new InputMismatchException();
                    }
                    if (snumChars <= 0)
                        return -1;
                }
                return buf[curChar++];
            }
    
            public int nextInt() {
                int c = snext();
                while (isSpaceChar(c)) {
                    c = snext();
                }
                int sgn = 1;
                if (c == '-') {
                    sgn = -1;
                    c = snext();
                }
                int res = 0;
                do {
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
            }
    
            public long nextLong() {
                int c = snext();
                while (isSpaceChar(c)) {
                    c = snext();
                }
                int sgn = 1;
                if (c == '-') {
                    sgn = -1;
                    c = snext();
                }
                long res = 0;
                do {
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
            }
    
            public int[] nextIntArray(int n) {
                int a[] = new int[n];
                for (int i = 0; i < n; i++) {
                    a[i] = nextInt();
                }
                return a;
            }
    
            public String readString() {
                int c = snext();
                while (isSpaceChar(c)) {
                    c = snext();
                }
                StringBuilder res = new StringBuilder();
                do {
                    res.appendCodePoint(c);
                    c = snext();
                } while (!isSpaceChar(c));
                return res.toString();
            }
    
            public String nextLine() {
                int c = snext();
                while (isSpaceChar(c))
                    c = snext();
                StringBuilder res = new StringBuilder();
                do {
                    res.appendCodePoint(c);
                    c = snext();
                } while (!isEndOfLine(c));
                return res.toString();
            }
    
            public boolean isSpaceChar(int c) {
                if (filter != null)
                    return filter.isSpaceChar(c);
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }
    
            private boolean isEndOfLine(int c) {
                return c == '\n' || c == '\r' || c == -1;
            }
    
            public interface SpaceCharFilter {
                public boolean isSpaceChar(int ch);
            }
        }
        