#abc250e. [abc250_e]Prefix Equality
[abc250_e]Prefix Equality
Problem Statement
You are given integer sequences and , each of length .
For , answer the query in the following format.
- If the set of values contained in the first terms of , , and the set of values contained in the first terms of , , are equal, then print
Yes
; otherwise, printNo
.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the response to the -th query.
Sample Input 1
5
1 2 3 4 5
1 2 2 4 3
7
1 1
2 2
2 3
3 3
4 4
4 5
5 5
Sample Output 1
Yes
Yes
Yes
No
No
Yes
No
Note that sets are a concept where it matters only whether each value is contained or not.
For the -rd query, the first terms of contain one and one , while the first terms of contain one and two 's. However, the sets of values contained in the segments are both , which are equal.
Also, for the -th query, the values appear in different orders, but they are still equal as sets.