407079: GYM102697 050 The Array Checker-inator!

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

050. The Array Checker-inator!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Given two arrays of integers, check if they are equal... But, if the arrays can be made equal through the removal of duplicates or sorting, they are equal.

Input

The first line will represent the elements, n, in the first array. Then, you will be given n integers inputted on their own lines. After that, another integer will be inputted, which represents the elements, m, in the second array. Then m integers will follow, all being inputted on separate lines.

Output

Print "YES" (without the quotes) if you these arrays are equal (or if they are equal after removing duplicates and sorting them), or "NO" (without the quotes) if the arrays cannot be made equal.

ExamplesInput
3
1
2
3
5
1
1
2
2
3
Output
YES
Input
4
1
2
3
4
3
1
2
7
Output
NO

加入题单

算法标签: