Kevin wrote an integer sequence $$$a$$$ of length $$$n$$$ on the blackboard.
Kevin can perform the following operation any number of times:
Kevin wants to know if it is possible to transform these integers into an integer sequence $$$b$$$ of length $$$m$$$ through some sequence of operations.
Two sequences $$$a$$$ and $$$b$$$ are considered the same if and only if their multisets are identical. In other words, for any number $$$x$$$, the number of times it appears in $$$a$$$ must be equal to the number of times it appears in $$$b$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1\leq m \leq n \leq 2\cdot 10^5$$$) — the length of $$$a$$$ and the length of $$$b$$$.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1\leq a_i \leq 10^9$$$).
The third line contains $$$m$$$ integers $$$b_1, b_2, \ldots, b_m$$$ ($$$1\leq b_i \leq 10^9$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot 10^5$$$.
For each test case, output "Yes" if it is possible to transform $$$a$$$ into $$$b$$$, and "No" otherwise.
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
92 14 592 13 694 21 2 2 23 44 21 1 3 33 54 21 2 3 43 55 51 2 3 4 55 4 3 2 14 21 1 1 11 14 41 1 1 11 1 1 21 111000000000
Yes No Yes Yes No Yes No No No
In the first test case, you can erase $$$4, 5$$$, and write down $$$9$$$.
In the second test case, you can't erase $$$3, 6$$$.
In the third test case, one possible way could be:
In the fourth test case, one possible way could be:
Name |
---|