You are given an array a_1, a_2, ..., a_n and an array b_1, b_2, ..., b_n.

For one operation you can sort in non-decreasing order any subarray a[l ... r] of the array a.

For example, if a = [4, 2, 2, 1, 3, 1] and you choose subbarray a[2 ... 5], then the array turns into [4, 1, 2, 2, 3, 1]. 

You are asked to determine whether it is possible to obtain the array b by applying this operation any number of times (possibly zero) to the array a.

Input

The first line contains one integer t (1 ≤ t ≤ 3 ⋅ 10^5) — the number of queries.

The first line of each query contains one integer n (1 ≤ n ≤ 3 ⋅ 10^5).

The second line of each query contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ n).

The third line of each query contains n integers b_1, b_2, ..., b_n (1 ≤ b_i ≤ n).

It is guaranteed that ∑ n ≤ 3 ⋅ 10^5 over all queries in a test.

Output

For each query print YES (in any letter case) if it is possible to obtain an array b and NO (in any letter case) otherwise.

Example

Input


4
7
1 7 1 4 4 5 6
1 1 4 4 5 7 6
5
1 1 3 3 5
1 1 3 3 5
2
1 1
1 2
3
1 2 3
3 2 1


Output


YES
YES
NO
NO

Note

In first test case the can sort subarray a_1 ... a_5, then a will turn into [1, 1, 4, 4, 7, 5, 6], and then sort subarray a_5 ... a_6.
/* Rajkin Hossain */

import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class D{
   
    FastInput k = new FastInput(System.in);
    //FastInput k = new FastInput("C:/Users/rajkin.h/Desktop/input.txt");
    FastOutput z = new FastOutput();

    int n;
    
    SegmentTree segTree;
    Treap treap;
    
    int [] data;
    int [] output;
    
    ArrayDeque<Integer> [] indexes;
    
    void startAlgo() {
    	boolean isPossible = true;
    	int start = 1;
    	for(int i = 1; i<=n; i++) {
    		int kth = (int) treap.getKth(start);
    		
    		if(data[kth] == output[i]) {
    			indexes[data[kth]].pollFirst();
    			start++;
    		}
    		else if(indexes[output[i]].isEmpty()){
    			isPossible = false;
    			break;
    		}
    		else {
    			int index = indexes[output[i]].pollFirst();
    			int minValue = segTree.query(kth, index);
    			
    			segTree.update(index, Integer.MAX_VALUE);
    			treap.delete(index);
    			
    			if(minValue != output[i]) {
    				isPossible = false;
    				break;
    			}
    		}
    	}
    	
    	if(isPossible) {
    		z.println("YES");
    	}
    	else {
    		z.println("NO");
    	}
    }
    
	void startProgram() {
		
		int q = k.nextInt();
		
		while(q-->0) {
			n = k.nextInt();
			
			data = new int[n+1];
			output = new int[n+1];
			
			indexes = new ArrayDeque[n+1];
			
			for(int i = 1; i<=n; i++) {
				data[i] = k.nextInt();
				indexes[i] = new ArrayDeque<Integer>();
			}
			
			for(int i = 1; i<=n; i++) {
				indexes[data[i]].add(i);
			}
			
			for(int i = 1; i<=n; i++) {
				output[i] = k.nextInt();
			}
			
			segTree = new SegmentTree(n);
			treap = new Treap();
			
			for(int i = 1; i<=n; i++) {
				treap.insert(i);
			}
			
			startAlgo();
		}
    	
    	z.flush();
    	System.exit(0);
    }
	
	public class Treap {
		
	    Node root;
		
	    int length;
	    int g_seed;
	    int ans;
	       
	    public Treap(){
	        g_seed = 1;
	        length = 0;
	    }
	       
	    int fastrand() {
	        g_seed = (214013 * g_seed + 2531011);
	        
	        return (g_seed>>16) & 0x7FFF;
	    }
	       
	    int getSize(Node cursor){
	        if(cursor == null) return 0;
	        
	        int leftSubTreeSize = cursor.left != null ? cursor.left.size : 0;
	        int rightSubTreeSize = cursor.right != null ? cursor.right.size : 0;
	       
	        return 1 + leftSubTreeSize + rightSubTreeSize;
	    }
	       
	    Node rotateRight(Node cursor){
	        Node returedNode = cursor.left;
	       
	        Node z = cursor.left.right;
	        cursor.left.right = cursor;
	        cursor.left = z;
	       
	        return returedNode;
	    }
	   
	    Node rotateLeft(Node cursor){
	        Node returedNode = cursor.right;
	       
	        Node z = cursor.right.left;
	        cursor.right.left = cursor;
	        cursor.right = z;
	       
	        return returedNode;
	    }
	       
	    Node insert(Node cursor, long value){
	        if(cursor == null) {
	            return new Node(value);
	        }
	       
	        if(value < cursor.value){
	            cursor.left = insert(cursor.left, value);
	           
	            if(cursor.left.priority > cursor.priority){
	                cursor = rotateRight(cursor);
	            }
	        }
	        else{
	            cursor.right = insert(cursor.right, value);
	           
	            if(cursor.right.priority > cursor.priority){
	                cursor = rotateLeft(cursor);
	            }
	        }
	       
	        if(cursor.left != null) cursor.left.size = getSize(cursor.left);
	        if(cursor.right != null) cursor.right.size = getSize(cursor.right);
	       
	        cursor.size = getSize(cursor);
	       
	        return cursor;
	    }
	        
	    void insert(long value){
	        root = insert(root, value);
	        length++;
	    }
	   
	    Node delete(Node cursor, long key) {
	        if (cursor == null) return cursor;
	       
	        if (key < cursor.value) {
	            cursor.left = delete(cursor.left, key);
	        }
	        else if (key > cursor.value) {
	            cursor.right = delete(cursor.right, key);
	        }
	        else if (cursor.left == null) {
	            cursor = cursor.right;
	        }
	        else if (cursor.right == null) {
	            cursor = cursor.left;
	        }
	        else if (cursor.left.priority < cursor.right.priority){
	            cursor = rotateLeft(cursor);
	            cursor.left = delete(cursor.left, key);
	        }
	        else {
	            cursor = rotateRight(cursor);
	            cursor.right = delete(cursor.right, key);
	        }
	       
	        if(cursor != null) {
	            if(cursor.left != null) cursor.left.size = getSize(cursor.left);
	            if(cursor.right != null) cursor.right.size = getSize(cursor.right);
	           
	            cursor.size = getSize(cursor);
	        }
	     
	        return cursor;
	    }
	       
	    void delete(long key){
	        root = delete(root, key);
	        length--;
	    }
	       
	    Node getKth(Node temp, int par, int k){
	      	if(temp == null) return null;
	            
	    	int currSize = par + getSize(temp.left) + 1;
	        if(currSize == k) return temp;
	 
	        else if(currSize <= k) return getKth(temp.right, currSize, k);
	        else return getKth(temp.left, par, k);
	    }
	       
	    long getKth(int k){
	        if(k > length) return -1;
	        return getKth(root, 0, k).value;
	    }
	   
	    class Node {
	        double priority;
	        long value;
	        int size;
	       
	        Node left, right;
	        public Node(long value){
	            this.value = value;
	            //this.priority = Math.random();
	            this.priority = fastrand();
	        }
	    }
	}
	
	public class SegmentTree {
	    int [] tree;
	    int treeLength;
	    
	    public SegmentTree(int max_size) {
	        tree = new int[max_size * 4];
	        
	        treeLength = max_size;
	       
	        initialize(1, 1, treeLength);
	    }
	       
	    public void initialize(int nodeId, int i, int j) {
	        if (i == j) {
	            tree[nodeId] = data[i];
	            
	            return;
	        }
	        
	        int left = nodeId * 2;
	        int right = nodeId * 2 + 1;
	        int mid = (i + j) / 2;
	       
	        initialize(left, i, mid);
	        initialize(right, mid + 1, j);
	        
	        tree[nodeId] = Math.min(tree[left], tree[right]);
	    }
	       
	    public int query(int b, int e) {
	        return query(1, 1, treeLength, b, e);
	    }
	       
	    public int query(int nodeId, int i, int j, int b, int e) {
	        if (i>e || j<b) {  
	            return Integer.MAX_VALUE;
	        }
	       
	        if (i>=b && j<=e) {
	        	
	            return tree[nodeId];
	        }
	       
	        int left = nodeId * 2;
	        int right = nodeId * 2 + 1;
	        int mid = (i + j) / 2;
	           
	        return Math.min(query(left, i, mid, b , e) , query(right, mid + 1, j, b, e));
	    }
	    
	    public void update(int index, int value) {
	        update(1, 1, treeLength, index, value);
	    }
	   
	    public void update(int nodeId, int i, int j, int index, int value) {
	        if (j<index || i>index) {
	            return;
	        }
	       
	        if (i == index && index == j) {
	            tree[nodeId] = value;
	           
	            return;
	        }
	       
	        int left = nodeId * 2;
	        int right = nodeId * 2 + 1;
	        int mid = (i + j) / 2;
	       
	        update(left, i, mid, index, value);
	        update(right, mid + 1, j, index, value);
	       
	        tree[nodeId] = Math.min(tree[left], tree[right]);
	    }
	}
    
    public static void main(String [] args) throws IOException {
        new Thread(null, new Runnable(){
            public void run(){
            	try{ 
            		new D().startProgram();
            	}
            	catch(Exception e){
            		e.printStackTrace();
            	}
            }
        },"Main",1<<28).start();
    }
    

    /* MARK: FastInput and FastOutput */
 
    class FastInput {
        BufferedReader reader;
        StringTokenizer tokenizer;
 
        FastInput(InputStream stream){
            reader = new BufferedReader(new InputStreamReader(stream));
        }
       
        FastInput(String path){
            try {
                reader = new BufferedReader(new FileReader(path));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            tokenizer = null;
        }
 
        String next() {
            return nextToken();
        }
       
        String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
           
            return null;
        }
 
        boolean hasNext(){
            try {
                return reader.ready();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return false;
        }
 
        String nextToken() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = null;
                try {
                    line = reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(nextToken());
        }
       
        long nextLong() {
            return Long.valueOf(nextToken());
        }
        
        double nextDouble() {
            return Double.valueOf(nextToken());
        }
    }
 
    class FastOutput extends PrintWriter {
		FastOutput() {
			super(new BufferedOutputStream(System.out)); 
		}
		
		public void debug(Object...obj) {
		    System.err.println(Arrays.deepToString(obj));
		}
    }
}