The pseudocode of function f is as follows:
function f(int n, array a[], int m):
for i from m - 1 to n - 1:
sort elements in a[i-m+1 .. i] in non-decreasing order
return array a[0 .. n-1]
Now you are given
n,
m,
k and the return array
ret[0 .. n-1] of this function.
Please find the array
b[0 .. n-1] which is the
k-th lexicographically smallest array of length
n that satisfies
f(n, b, m) = ret[0 .. n-1].
The input will be given such that there are at least
k different arrays of length
n that function f returns
ret[0 .. n-1] when being the input array.
输入描述:
The first line contains one integer t (
) --- the number of test cases.
Each test contains two lines. The first line contains three integers n, m, k (

,

,

). The second line contains n integers ret[0], ret[1], ..., ret[n-1]. (ret[0 .. n-1] is a permutation of

)
The sum of n across the test cases doesn't exceed
.
输出描述:
For each test, output one line contains n integers, representing b[0 .. n-1].
示例1
输入
复制
7
3 2 1
1 2 3
3 2 2
1 2 3
3 2 3
1 2 3
3 2 4
1 2 3
3 2 1
2 1 3
3 2 2
2 1 3
5 3 6
3 1 2 4 5
输出
复制
1 2 3
1 3 2
2 1 3
3 1 2
2 3 1
3 2 1
5 4 3 1 2