Codeforces Round 1004 (Div. 2) |
---|
Finished |
You have two large bags of numbers. Initially, the first bag contains $$$n$$$ numbers: $$$a_1, a_2, \ldots, a_n$$$, while the second bag is empty. You are allowed to perform the following operations:
You can perform an unlimited number of operations of both types, in any order. Is it possible to make the contents of the first and second bags identical?
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 an integer $$$n$$$ ($$$2 \le n \le 1000$$$) — the length of the array $$$a$$$. It is guaranteed that $$$n$$$ is an even number.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le n$$$).
It is guaranteed that the sum of $$$n^2$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, print "YES" if it is possible to equalize the contents of the bags. Otherwise, output "NO".
You can output each letter in any case (for example, "YES", "Yes", "yes", "yEs", "yEs" will be recognized as a positive answer).
921 122 141 1 4 443 4 3 342 3 4 463 3 4 5 3 362 2 2 4 4 481 1 1 1 1 1 1 4109 9 9 10 10 10 10 10 10 10
Yes No Yes Yes No Yes No Yes Yes
Let's analyze the sixth test case: we will show the sequence of operations that leads to the equality of the bags. Initially, the first bag consists of the numbers $$$(3, 3, 4, 5, 3, 3)$$$, and the second bag is empty.
As we can see, as a result of these operations, it is possible to make the contents of the bags equal, so the answer exists.
Name |
---|