There are integers arranged from left to right in the order . You may perform the following operation on the sequence.
The deleted element disappears, and the remaining elements retain their relative order. The changes affect all remaining elements on the corresponding side, not just the adjacent elements, and accumulate across operations.
For example, deleting the middle element from produces . Deleting the rightmost element next leaves .
Repeat the operation until exactly one element remains. Find the maximum possible value of that element.
The initial values, intermediate values, and final value may all be negative. If , no operations are performed and the initial element remains.
The input is given in the following format.
For each test case, print the maximum possible value of the final remaining element on a separate line.
In the first test case, the deletions described in the statement leave , and no larger final value is possible.
In the second test case, there is already only one element, so no operations are performed.
In the third test case, deleting the leftmost element produces . Deleting the rightmost element next leaves , which is the maximum possible value.
Here, is the number of test cases. Each test case is given in the following format.
The first line contains the length of the sequence. The second line contains its elements from left to right, separated by spaces.
| 4 | 42 | No additional constraints. |
In the fourth test case, deleting the rightmost element three times produces , then , and finally . The maximum possible final value may be negative.
This sample satisfies the conditions of subtasks , , and .