Problem2324--Shoe Shuffling

2324: Shoe Shuffling

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

A class of students got bored wearing the same pair of shoes every day, so they decided to shuffle their shoes among themselves. In this problem, a pair of shoes is inseparable and is considered as a single object.

There are nn students in the class, and you are given an array ss in non-decreasing order, where sisi is the shoe size of the ii-th student. A shuffling of shoes is valid only if no student gets their own shoes and if every student gets shoes of size greater than or equal to their size.

You have to output a permutation pp of {1,2,…,n}{1,2,…,n} denoting a valid shuffling of shoes, where the ii-th student gets the shoes of the pipi-th student (pi≠ipi≠i). And output −1−1 if a valid shuffling does not exist.

A permutation is an array consisting of nn distinct integers from 11 to nn in arbitrary order. For example, [2,3,1,5,4][2,3,1,5,4] is a permutation, but [1,2,2][1,2,2] is not a permutation (22 appears twice in the array) and [1,3,4][1,3,4] is also not a permutation (n=3n=3 but there is 44 in the array).

Input

Each test contains multiple test cases. The first line contains a single integer tt (1≤t≤10001≤t≤1000) — the number of test cases. Description of the test cases follows.

The first line of each test case contains a single integer nn (1≤n≤1051≤n≤105) — the number of students.

The second line of each test case contains nn integers s1,s2,…,sns1,s2,…,sn (1≤si≤1091≤si≤109, and for all 1≤i<n1≤i<nsi≤si+1si≤si+1) — the shoe sizes of the students.

It is guaranteed that the sum of nn over all test cases does not exceed 105105.

Output

For each test case, print the answer in a single line using the following format.

If a valid shuffling does not exist, print the number −1−1 as the answer.

If a valid shuffling exists, print nn space-separated integers — a permutation pp of 1,2,…,n1,2,…,n denoting a valid shuffling of shoes where the ii-th student gets the shoes of the pipi-th student. If there are multiple answers, then print any of them.

Sample Input Copy

2
5
1 1 1 1 1
6
3 6 8 13 15 21

Sample Output Copy

5 1 2 3 4 
-1

HINT

In the first test case, any permutation pp of 1,…,n1,…,n where pi≠ipi≠i would represent a valid shuffling since all students have equal shoe sizes, and thus anyone can wear anyone's shoes.

In the second test case, it can be shown that no valid shuffling is possible.

Source/Category