Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/saralash-aralashtirilganmi

Is it a shuffle?

Easy 1000 ms 128 MB 31%
Share

Two arrays are given: $a_{1}, \ldots, a_{n}$ and $b_{1}, \ldots, b_{n}$. Can array $b$ be obtained by rearranging the elements of array $a$? That is, does every value occur the same number of times in both arrays? If it can, print YES, otherwise NO.

Two arrays: equal values are joined by lines

Input

The first line contains a positive integer $n$. The second line contains $n$ integers $a_{i}$, the third line contains $n$ integers $b_{i}$.

Output

YES or NO.

Note

$1 \le n \le 2 * 10^{5}$
$-10^{9} \le a_{i}, b_{i} \le 10^{9}$

Examples

Input #1
4
3 1 2 3
3 3 2 1
Output #1
YES
Input #2
3
1 2 2
1 1 2
Output #2
NO

Sign in to submit a solution

Signing up is free and takes a minute.