------
## 最终结论
```python
# Read the number of test cases
t = int(input())
results = []

for _ in range(t):
    n = int(input())
    q = list(map(int, input().split()))

    # Initialize variables to construct permutation p
    p = []
    used = set()  # To keep track of used numbers
    possible = True

    for i in range(n):
        if i == 0:
            # The first element of p must be q[0]
            p.append(q[0])
            used.add(q[0])
        else:
            if q[i] > q[i - 1]:
                # If q[i] is greater than the previous max, it must be the new max
                p.append(q[i])
                used.add(q[i])
            else:
                # If q[i] is equal to the previous max, we need to find a number less than q[i]
                found = False
                for num in range(1, n + 1):
                    if num not in used and num < q[i]:
                        p.append(num)
                        used.add(num)
                        found = True
                        break
                
                if not found:
                    possible = False
                    break

    if possible and len(set(p)) == n:  # Check if we have a valid permutation
        results.append(" ".join(map(str, p)))
    else:
        results.append("-1")

# Print all results for each test case
print("\n".join(results))
```