#C6896. Taco: Can Make Arrays Equal

    ID: 50706 Type: Default 1000ms 256MiB

Taco: Can Make Arrays Equal

Taco: Can Make Arrays Equal

You are given two arrays a and b of length n. Your task is to determine whether it is possible to make the two arrays equal by performing a series of operations. In this problem, an operation is defined as any transformation that does not change the multiset of elements of the array. Therefore, if the sorted order of the two arrays is identical, then it is possible to make the arrays equal. Formally, let (a = [a_1,a_2,\dots,a_n]) and (b = [b_1,b_2,\dots,b_n]). You need to check whether (\text{sort}(a) = \text{sort}(b)).

Input Format: The input is read from stdin.

inputFormat

The first line contains a single integer (q) denoting the number of test cases. Each test case consists of three lines:

  1. An integer (n) denoting the number of elements in each array.
  2. (n) space-separated integers representing the elements of array a.
  3. (n) space-separated integers representing the elements of array b.

    All input should be read from standard input (stdin).

outputFormat

For each test case, output a single line containing "YES" if it is possible to make arrays a and b equal after performing some operations, or "NO" otherwise. The results should be printed to standard output (stdout).## sample

3
4
1 2 3 4
4 3 2 1
5
3 3 3 3 3
3 3 3 3 3
4
2 4 6 8
1 3 5 7
YES

YES NO

</p>