Universal Cup Judging System

Universal Cup

Time Limit: 1 s Memory Limit: 512 MB Total points: 100 Hackable ✓
Statistics

Yuki is the chief judge of the International Convex Polygon Championship (ICPC). He proposed a geometry problem for the competition. However, due to his lack of experience in geometry, he failed to generate correct convex polygon data.

To prove his geometric ability, Yuki started playing with sticks again. He has $n$ sticks, where the length of the $i$-th stick is $a_i$. He intends to choose at least $3$ sticks from them such that these sticks can form a non-degenerate convex polygon$^*$.

However, since Yuki does not know much about geometry, he does not know how to choose the sticks. As a good friend of Yuki, you need to help him find a subset of sticks such that:

  • The subset contains at least $3$ sticks, and the number of sticks is as large as possible;

  • For any subset of at least $3$ sticks chosen from this subset, these sticks can form a non-degenerate convex polygon.

Or report that no such subset exists.

$^*$: A non-degenerate convex polygon is a polygon where all side lengths are greater than zero, no three vertices are collinear, and all interior angles are strictly less than $180^\circ$.

Input

This problem contains multiple test cases.

The first line contains a positive integer $t$ ($1 \le t \le 10^5$), representing the number of test cases.

For each test case:

  • The first line contains a positive integer $n$ ($3 \le n \le 5 \cdot 10^5$).

  • The second line contains $n$ positive integers $a_1,\ldots,a_n$ ($1 \le a_i \le 10^9$).

It is guaranteed that the sum of $n$ over all test cases does not exceed $5 \cdot 10^5$.

Output

For each test case, output one line:

  • If no such subset exists, output a single integer $0$.

  • If such a subset exists, first output an integer $k$, representing the size of the subset you found, followed by $k$ integers $b_1,\ldots,b_k$, representing the lengths of the $k$ sticks in your subset.

Examples

Input 1

3
4
6 9 2 6
3
4 4 9
6
3 1 4 6 5 9

Output 1

3 6 2 6
0
4 3 4 5 6

Note

For the first test case:

  • $\{6,2,6\}$ is a valid subset; since $2+6>6$, these $3$ sticks can form a non-degenerate triangle; it is easy to prove that no larger valid subset exists.

  • $\{6,6,9\}$ is also a valid subset.

For the second test case:

  • It can be proven that no valid subset exists.

For the third test case:

  • $\{3,4,5,6\}$ is a valid subset; in this case, Yuki has $5$ ways to choose sticks: $\{3,4,5\}$, $\{3,4,6\}$, $\{3,5,6\}$, $\{4,5,6\}$, $\{3,4,5,6\}$, and each way can form a non-degenerate convex polygon; it is easy to prove that no larger valid subset exists.

  • $\{3,4,5,6,9\}$ is not a valid subset because the sticks with lengths $3,4,9$ cannot form a non-degenerate triangle.

  • $\{3,5,6\}$ is not a valid subset because there exists a larger valid subset.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.