You are given \(n\) positive integers \(x_1, x_2, \ldots, x_n\) and three positive integers \(n_a, n_b, n_c\) satisfying \(n_a+n_b+n_c = n\).
You want to split the \(n\) positive integers into three groups, so that:
- The first group contains \(n_a\) numbers, the second group contains \(n_b\) numbers, the third group contains \(n_c\) numbers.
- Let \(s_a\) be the sum of the numbers in the first group, \(s_b\) be the sum in the second group, and \(s_c\) be the sum in the third group. Then \(s_a, s_b, s_c\) are the sides of a triangle with positive area.
Determine if this is possible. If this is possible, find one way to do so.
Output
For each test case, print \(\texttt{YES}\) if it is possible to split the numbers into three groups satisfying all the conditions. Otherwise, print \(\texttt{NO}\).
If such a split exists, then describe the three groups as follows.
On the next line, print \(n_a\) integers \(a_1, a_2, \ldots, a_{n_a}\) — the numbers in the first group.
On the next line, print \(n_b\) integers \(b_1, b_2, \ldots, b_{n_b}\) — the numbers in the second group.
On the next line, print \(n_c\) integers \(c_1, c_2, \ldots, c_{n_c}\) — the numbers in the third group.
These \(n_a+n_b+n_c=n\) integers should be a permutation of \(x_1, x_2, \ldots, x_n\), and they should satisfy the conditions from the statement.
If there are multiple solutions, print any of them.
Note
In the first test case, we can put two \(1\)s into each group: the sum in each group would be \(2\), and there exists a triangle with positive area and sides \(2\), \(2\), \(2\).
In the second and third test cases, it can be shown that there is no such way to split numbers into groups.
In the fourth test case, we can put number \(16\) into the first group, with sum \(16\), numbers \(12\) and \(1\) into the second group, with sum \(13\), and the remaining five \(1\)s into the third group, with sum \(5\), as there exists a triangle with positive area and sides \(16, 13, 5\).
Примеры
| № | Входные данные | Выходные данные |
|
1
|
4 6 2 2 2 1 1 1 1 1 1 5 3 1 1 1 1 1 1 1 6 2 2 2 1 1 1 1 1 3 8 1 2 5 16 1 1 1 1 1 1 12
|
YES
1 1
1 1
1 1
NO
NO
YES
16
12 1
1 1 1 1 1
|