Problem: Petya got an array of numbers from to , where .
He performed operations sequentially. In the end, he received a new state of the array.
At the -th operation, Petya chose the first elements of the array and cyclically shifted them to the right an arbitrary number of times (elements with indexes and more remain in their places). One cyclic shift to the right is such a transformation that the array becomes equal to the array .
For example, if and (that is, this is the third operation), then as a result of this operation, he could get any of these three arrays:
- (makes cyclic shifts, or any number that is divisible by );
- (makes cyclic shift, or any number that has a remainder of when divided by );
- (makes cyclic shifts, or any number that has a remainder of when divided by ).
Let's look at an example. Let , i.e. initially . A possible scenario is described below.
- : no matter how many cyclic shifts Petya makes, the array does not change.
- : let's say Petya decided to make a cyclic shift, then the array will look like .
- : let's say Petya decided to make cyclic shift, then the array will look like .
- : let's say Petya decided to make cyclic shifts, the original array will look like .
- : let's say Petya decided to make cyclic shifts, then the array won't change.
- : let's say Petya decided to make cyclic shifts, the array will look like .
You are given a final array state after all operations. Determine if there is a way to perform the operation that produces this result. In this case, if an answer exists, print the numbers of cyclical shifts that occurred during each of the operations.
Input Format: The first line of the input contains an integer () — the number of test cases in the test.
The descriptions of the test cases follow.
The first line of the description of each test case contains one integer () — the length of the array .
The next line contains the final state of the array : integers () are written. All are distinct.
It is guaranteed that the sum of values over all test cases does not exceed .
Output Format: For each test case, print the answer on a separate line.
Print -1 if the given final value cannot be obtained by performing an arbitrary number of cyclic shifts on each operation. Otherwise, print non-negative integers (), where means that during the -th operation the first elements of the array were cyclic shifted to the right times.
If there are several possible answers, print the one where the total number of shifts is minimal (that is, the sum of values is the smallest). If there are several such answers, print any of them.
Note: The first test case matches the example from the statement.
The second set of input data is simple. Note that the answer also gives the same permutation, but since the total number of shifts is greater than , this answer is not correct.