In a vast network of interconnected servers, an advanced Artificial Intelligence named Mighty Kuddus began its mission to analyze massive data sets. One day, it stumbled upon a peculiar challenge: finding two specific arrays hidden within the sea of information. Mighty Kuddus tirelessly searched through the digital world, using complex mathematical calculations to reveal hidden arrays and make them equal. After a lengthy search, it discovered a complicated method to make the arrays equal.
As a highly skilled programmer, you find this task straightforward and easily achievable. You have arrays $A$ and $B$ of length $n$ discovered by Mighty Kuddus. To make the arrays equal, the only operation you can do is swap any element of the first array with any element of the second array. More formally, for each $A_i \: (1\le i\le n)$you can swap it with any $B_j \: (1\le j\le n)$. You can perform this operation as many times as you want(possibly zero).
Now write a program to complete the task. Two arrays $A$ and $B$ are considered equal if and only if $A_i=B_i$ for all $(1\le i\le n)$.
Each test contains multiple test cases. The first line of input contains a single integer $t \: (1\le t\le 10^2)$ — the number of test cases. The description of test cases follows.
The first line of each test case contains a single integer $n \:(1≤n≤10^3)$ - the length of the arrays.
The second line of each test case contains $n$ integers $A_1,A_2,…,A_{n-1},A_n \: (1≤A_i≤10^5)$ - the elements of array $A$.
The third line of each test case contains $n$ integers $B_1,B_2,…,B_{n-1},B_n (1≤B_i≤10^5)$ - the elements of array $B$.
For each test case, output “yes” without quotation if you can make the arrays similar otherwise output “no” without quotation. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).
Input | Output |
---|---|
1 3 1 3 5 5 1 3 | yes |