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.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rustam Musin (t.me/musin_acm)
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        DSortirovkaPodotrezkov solver = new DSortirovkaPodotrezkov();
        solver.solve(1, in, out);
        out.close();
    }

    static class DSortirovkaPodotrezkov {
        int[] lenToLog;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            init((int) 3e5);
            int t = in.readInt();
            while (t-- > 0) {
                int n = in.readInt();
                int[] a = in.readIntArray(n);
                int[] b = in.readIntArray(n);
                boolean ok = subSolve(a, b) && subSolve(rev(a), rev(b));
                out.printLine(ok ? "YES" : "NO");
            }
        }

        int[] rev(int[] a) {
            int n = a.length;
            int[] b = new int[n];
            for (int i = 0; i < n; i++) {
                b[i] = -a[n - i - 1];
            }
            return b;
        }

        boolean subSolve(int[] a, int[] b) {
            int n = a.length;
            Map<Integer, List<Integer>> apos = positions(a);
            Map<Integer, List<Integer>> bpos = positions(b);
            boolean fail = apos.size() != bpos.size();
            int[] newPos = new int[n];
            for (Map.Entry<Integer, List<Integer>> e : apos.entrySet()) {
                List<Integer> inB = bpos.get(e.getKey());
                if (inB == null || e.getValue().size() != inB.size()) {
                    fail = true;
                }
                if (fail) {
                    break;
                }
                for (int i = 0; i < inB.size(); i++) {
                    newPos[e.getValue().get(i)] = inB.get(i);
                }
            }

            int[] inv = new int[n];
            for (int i = 0; i < n; i++) {
                inv[newPos[i]] = i;
            }

            MaxTree maxTree = new MaxTree(n);
            for (int i = 0; i < n; i++) {
                maxTree.set(i, a[i]);
            }
            for (int i = n - 1; i >= 0 && !fail; i--) {
                int from = inv[i];
                if (from <= i) {
                    fail = maxTree.get(from + 1, n - 1) >= a[from];
                }
                maxTree.set(from, Integer.MIN_VALUE);
            }

            return !fail;
        }

        Map<Integer, List<Integer>> positions(int[] a) {
            Map<Integer, List<Integer>> res = new HashMap<>();
            for (int i = 0; i < a.length; i++) {
                res.computeIfAbsent(a[i], k -> new ArrayList<>()).add(i);
            }
            return res;
        }

        void init(int n) {
            lenToLog = new int[n + 1];
            for (int i = 1, j = 0; i <= n; i++) {
                if (i == (1 << (j + 1))) {
                    j++;
                }
                lenToLog[i] = j;
            }
        }

        class MaxTree {
            int[] tree;
            int n;

            MaxTree(int sz) {
                int log = 0;
                while (1 << log < sz) {
                    log++;
                }
                n = 1 << log;
                tree = new int[n * 2];
                Arrays.fill(tree, Integer.MIN_VALUE);
            }

            void set(int at, int x) {
                tree[at += n] = x;
                while ((at >>= 1) > 0) {
                    tree[at] = Math.max(tree[at << 1], tree[at << 1 | 1]);
                }
            }

            int get(int l, int r) {
                int mx = Integer.MIN_VALUE;
                for (l += n, r += n; l <= r; l >>= 1, r >>= 1) {
                    if (l % 2 == 1) {
                        mx = Math.max(mx, tree[l++]);
                    }
                    if (r % 2 == 0) {
                        mx = Math.max(mx, tree[r--]);
                    }
                }
                return mx;
            }

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = readInt();
            }
            return array;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

