You are given an array
of length . Find any permutation of length such that only the prefixes of length () form a permutation.
Under the given constraints, it is guaranteed that there exists at least one permutation which satisfies the given condition.
If there are multiple solutions, you may print any.
Note: A permutation of length is an array where every element from to occurs exactly once.
Input Format
- The first line of the input contains a single integer - the number of test cases.
- The first line of each test case contains two integers and - the length of the permutation to be constructed and the size of the array respectively.
- The second line of each test case contains space-separated integers denoting the array .
Output Format
For each test case, print a single line containing space-separated integers . If there are multiple solutions, you may print any.
Constraints
- the sum of over all test cases does not exceed
Sample Input 1
3
8 4
3 6 7 8
7 1
7
5 5
1 2 3 4 5
Sample Output 1
2 3 1 6 4 5 7 8
4 6 1 5 2 7 3
1 2 3 4 5
Explanation
Test case-1: is valid permutation because
- Prefix of length is a permutation.
- Prefix of length is a permutation.
- Prefix of length is a permutation.
- Prefix of length is a permutation.
- None of the other prefixes form a permutation.
ConversionConversion EmoticonEmoticon