Question
Max numbers
Given a sequence of N numbers, you need to find its maximum, 2nd maximum and 3rd maximum element.
Input
The first line of the input contains the number of test cases T.
For each test case, the first line of the input contains an integer N denoting the number of elements in the list A. The following line contains N (space-separated) elements of A.

Constraints:
1 <= T <= 100
3 <= N <= 106
1 <= A[i] <= 109
Note:-It is guaranteed that the sum of N over all test cases does not exceed 106
Output
For each test case, output the first, second and third maximum elements in the list.
Example
Sample Input:
3
5
1 4 2 4 5
6
1 3 5 7 9 8
7
11 22 33 44 55 66 77

Sample Output:
5 4 4
9 8 7
77 66 55

Explanation:
Testcase 1:
[1 4 2 4 5]
First max = 5
Second max = 4
Third max = 4

Online