An array $$$a$$$ is called ugly if it contains at least one element which is equal to the sum of all elements before it. If the array is not ugly, it is beautiful.
For example:
You are given an array $$$a$$$ such that $$$1 \le a_1 \le a_2 \le \dots \le a_n \le 100$$$. You have to reorder the elements of $$$a$$$ in such a way that the resulting array is beautiful. Note that you are not allowed to insert new elements or erase existing ones, you can only change the order of elements of $$$a$$$. You are allowed to keep the array $$$a$$$ unchanged, if it is beautiful.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 2000$$$) — the number of test cases.
Each test case consists of two lines. The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_1 \le a_2 \le \dots \le a_n \le 100$$$).
For each test case, print the answer as follows:
443 3 6 6210 1051 2 3 4 531 4 4
YES 3 6 3 6 NO YES 2 4 1 5 3 YES 1 4 4
Name |
---|