Rahul is playing a VR game. He is stuck in a mission and needs your help.
In this mission, Rahul is stranded on a rock and needs to jump through a series of rock to save himself from falling into a death vortex. You are given T scenarios and at each scenario you have to tell whether Rahul will be able to jump on any of the rocks around him or not.
Now the problem is, Rahul can only jump on rock which can handle the weight greater than his weight. Luckily you know all the information, help Rahul by telling to jump on which rock.
First line of input contains T - the number of test cases. Next T lines contains 5 spaced integers.
First integer represents the weight of Rahul and the rest 4 integers represent the weight a rock can handle which is around him.
Print the weight of rock with maximum weight which will handle Rahul's weight. If there is no such rock print -1.
1 <= T <= 50
1 <= N, W[i] <= 1000
4 2 3 1 5
4 2 8 1 4
4 2 3 1 4
No explanation available