We define an element in a sequence "good", if and only if there exists
(1≤j<i) such that
.
Given a permutation p of integers from 1 to n. Remove an element from the permutation such that the number of "good" elements is maximized.
The input consists of several test cases. The first
line of the input gives the number of test cases,.
For each test case, the first line contains an
integer,
representing the length of the given permutation.
The second line contains n integersp1,p2,…,pn,
representing the given permutation p.
It's guaranteed that.
For each test case, output one integer in a single
line, representing the element that should be deleted. If there are several
answers, output the minimal one.