DCEPC905 - Picking Weights

no tags 

Ankur sir and Saikat sir are fighting again. Ankur sir thinks hold on number theory gives you an edge in ICPC whereas Saikat sir is adament that practicing DP gives you the best chance. They both go to Vaibhav sir and ask for his opinion. He believes, teamwork is the key to success and he lines up some (<=10^5) weights in a line. Then he asks them to pick one weight each such that the difference between the weights picked by Saikat sir and Ankur sir is minimum, also in case more than one optimum solutions exist, they choose both weights such that the combined weight is also the least amongst the solutions. Since, Saikat sir is Vaibhav sir’s team-mate he gets the first chance. By this time Sid sir comes in , to play his pranks. As soon as Saikat sir picks a weight, Sid sir absconds with all the weights before that weight. For example, if saikat sir picks the 5th weight. Sid sir runs away with the first 4 weights. Ankur sir, irritated by all this foolishness picks up the closest weight to Saikat sir, but he always picks up an equal or greater weight than him. I wonder why he does that!

Also note that Saikat sir never picks up the last weight. Saikat Sir and Ankur Sir both pick one weight each. Output the weights picked by Saikat sir then Ankur sir respectively. If no solution exists output -1.

Input

The first line of the input contains an integer t denoting number of test cases.
Each test case has 2 lines.
First line of each test case gives n the number of weights
The next line gives n space separated integers denoting the weights.

Output

Output "x y" (quotes for clarity) for each test case on a separate line , where x denotes the weight picked by Saikat Sir and y denotes the weight picked by Ankur Sir. If no solution is possible, output "-1"

Constraints

1<=t<=10
1<=n<=10^5

Each weight, 0>=x[i]<=2^31

Example

Input:
2
3
1 1 2
7
9 4 7 6 5 3 2 Output: 1 1
4 5

hide comments
zapa_zope: 2023-08-21 10:34:40

ez


Added by:dce coders
Date:2012-08-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP JAVA
Resource:Own Problem