#P1788A. One and Two
One and Two
No submission language available for this problem.
Description
You are given a sequence . Each element of is or .
Find out if an integer exists so that the following conditions are met.
- , and
- .
If there exist multiple that satisfy the given condition, print the smallest.
Each test contains multiple test cases. The first line contains the number of test cases (). Description of the test cases follows.
The first line of each test case contains one integer ().
The second line of each test case contains integers ().
For each test case, if there is no such , print .
Otherwise, print the smallest possible .
Input
Each test contains multiple test cases. The first line contains the number of test cases (). Description of the test cases follows.
The first line of each test case contains one integer ().
The second line of each test case contains integers ().
Output
For each test case, if there is no such , print .
Otherwise, print the smallest possible .
Note
For the first test case, satisfies the condition since . also satisfies the given condition, but the smallest should be printed.
For the second test case, there is no that satisfies
For the third test case, , , and satisfy the given condition, so the answer is .