You are given an array containing the integers from 1 to 2n, each number appearing exactly once. Your goal is to sort the array in increasing order using a special operation called "Qwiksort". In one execution of Qwiksort, you can choose a contiguous range of size n and sort them in increasing order in-place. For example, if n = 3 and the array is [3, 2, 4, 1, 6, 5], and you choose to apply Qwiksort to a contiguous range from second to fourth position, the array becomes [3, 1, 2, 4, 6, 5].
You can apply the Qwiksort operation zero or more times to sort the array. But due to limitations of our server, you can only do it at most 10 times on a particular array. Please print the operations required to sort the array in increasing order.
You do not need to minimize the number of operations. It is guaranteed that it’s possible to sort the arrays with at most 10 Qwiksort operations.
Input
First line of input will contain a single integer T denoting the number of independent test cases. Then the descriptions of T test cases follow. Each test case will start with a line containing an integer n. The next line will contain 2n space separated integers, the elements of the array to sort.
Constraints
- 1 ≤ T ≤ 40000
- 2 ≤ n ≤ 1000
- Sum of n over all test cases does not exceed 2 ${ \times }$ 105.
Output
For each test case, first print the case number and the number of Qwiksort operations k (k ≤ 10) required to sort the array in a line. Then print k lines, each line containing two space separated integers l and r denoting 1-based index specifying the beginning and end of the range that you applied Qwiksort to.
Note that 1 ≤ l ≤ r ≤ 2n and r - l + 1 = n must be ensured.
Sample
Sample Input | Sample Output |
---|---|
2 5 1 2 3 4 5 10 9 8 7 6 2 1 2 3 4 | Case 1: 2 6 10 2 6 Case 2: 0 |