Consider a certain permutation of integers from 1 to n as A={a1,a2,...,an} and reverse of array A as R, that is, R={an,an−1,...,a1}. You are given the inversions at each position of array A and R as {IA1,IA2,…..,IAn} and {IR1,IR2,…..,IRn} respectively.
Find the original array A. If, there are multiple solutions, print any of them. If there is no solution, then print -1.
Note: The inversion of array arr for position i is defined as the count of positions j satisfying the following condition arrj>arri and 1≤j<i.
Input format
Output format
For each test case, print the array A in the space-separated format or -1 if no solution exists. Each test case should be answered in a new line.
Constraints
1≤T≤101≤n≤1050≤IAi,IRi<n ∀ i∈[1,n]
For first test case
Consider permutation A={3,4,2,1}.
It can be seen that inversion for this array will be IA={0,0,2,3} as:
Now, R={1,2,4,3}.
It can be seen that inversion for this array will be IR={0,0,0,1} as:
Thus, A={3,4,2,1} is a valid permutation.
For second test case
There is no valid permutation that satisfies the condition.