Problem: You are given a permutation of size . You want to minimize the number of subarrays of that are permutations. In order to do so, you must perform the following operation exactly once:
- Select integers , , where , then
- Swap and .
For example, if and we choose , , the resulting array will be . If instead we choose , the resulting array will be .
Which choice of and will minimize the number of subarrays that are permutations?
A permutation of length is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array), and is also not a permutation ( but there is in the array).
An array is a subarray of an array if can be obtained from by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.
Input Format: The first line of the input contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer () — the size of the permutation.
The next line of each test case contains integers (, all are distinct) — the elements of the permutation .
It is guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case, output two integers and () — the indices to swap in .
If there are multiple solutions, print any of them.
Note: For the first test case, there are four possible arrays after the swap:
- If we swap and , we get the array , which has 3 subarrays that are permutations (, , ).
- If we swap and , we get the array , which has 3 subarrays that are permutations (, , ).
- If we swap and , we get the array , which has 2 subarrays that are permutations (, ).
- If we swap any element with itself, we get the array , which has 3 subarrays that are permutations (, , ).
For the third sample case, after we swap elements at positions and , the resulting array is . The only subarrays that are permutations are and . We can show that this is minimal.