Problem: Vasya has written some permutation p_1, p_2, …, p_n of integers from 1 to n, so for all 1 ≤ i ≤ n it is true that 1 ≤ p_i ≤ n and all p_1, p_2, …, p_n are different. After that he wrote n numbers next_1, next_2, …, next_n. The number next_i is equal to the minimal index i < j ≤ n, such that p_j > p_i. If there is no such j let's let's define as next_i = n + 1.

In the evening Vasya went home from school and due to rain, his notebook got wet. Now it is impossible to read some written numbers. Permutation and some values next_i are completely lost! If for some i the value next_i is lost, let's say that next_i = -1.

You are given numbers next_1, next_2, …, next_n (maybe some of them are equal to -1). Help Vasya to find such permutation p_1, p_2, …, p_n of integers from 1 to n, that he can write it to the notebook and all numbers next_i, which are not equal to -1, will be correct. 

Input

The first line contains one integer t — the number of test cases (1 ≤ t ≤ 100 000).

Next 2 ⋅ t lines contains the description of test cases,two lines for each. The first line contains one integer n — the length of the permutation, written by Vasya (1 ≤ n ≤ 500 000). The second line contains n integers next_1, next_2, …, next_n, separated by spaces (next_i = -1 or i < next_i ≤ n + 1).

It is guaranteed, that the sum of n in all test cases doesn't exceed 500 000.

In hacks you can only use one test case, so T = 1.

Output

Print T lines, in i-th of them answer to the i-th test case.

If there is no such permutations p_1, p_2, …, p_n of integers from 1 to n, that Vasya could write, print the only number -1.

In the other case print n different integers p_1, p_2, …, p_n, separated by spaces (1 ≤ p_i ≤ n). All defined values of next_i which are not equal to -1 should be computed correctly p_1, p_2, …, p_n using defenition given in the statement of the problem. If there exists more than one solution you can find any of them.

Example

Input


6
3
2 3 4
2
3 3
3
-1 -1 -1
3
3 4 -1
1
2
4
4 -1 4 5


Output


1 2 3
2 1
2 1 3
-1
1
3 2 1 4

Note

In the first test case for permutation p = [1, 2, 3] Vasya should write next = [2, 3, 4], because each number in permutation is less than next. It's easy to see, that it is the only satisfying permutation.

In the third test case, any permutation can be the answer because all numbers next_i are lost.

In the fourth test case, there is no satisfying permutation, so the answer is -1.

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

public class C {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int T = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		while(T-- > 0) {
			int n = sc.nextInt();
			int[] next = new int[n];
			boolean invalid = false;
			for(int i = 0; i < n; i++) {
				next[i] = sc.nextInt()-1;
				if(next[i] < 0) next[i] = i+1;
				if(next[i] < i) invalid = true;
			}
			if(invalid) {sb.append("-1\n"); continue;}
			int curr = n;
			int[] h = new int[n+1];
			h[n] = curr;
			for(int i = n-1; i >= 0; i--) {
				h[i] = h[next[i]]-1;
			}
			LinkedList<Integer>[] inds = new LinkedList[n];
			for(int i = 0; i < n; i++) inds[i] = new LinkedList<>();
			for(int i = 0; i < n; i++) {
				inds[h[i]].add(i);
			}
			long[] val = new long[n];
			curr = 1;
			for(int i = 0; i < n; i++) {
				while(!inds[i].isEmpty()) {
					val[inds[i].pollLast()] = curr++;
				}
			}
			boolean valid = true;
			SegmentTreeMax st = new SegmentTreeMax(val);
			for(int i = 0; i < n; i++) {
				if(st.rMq(i, next[i]-1) > val[i]) valid = false;
			}
			if(!valid) sb.append("-1\n");
			else {
				for(int i = 0; i < n; i++) sb.append(val[i]+" ");
				sb.replace(sb.length()-1, sb.length(), "\n");
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		pw.print(sb.toString());
		pw.flush();

	}
	
	static class SegmentTreeMax {         // the segment tree is stored like a heap array
		private long[] st; private long[] A;
		private int n;
		private int left (int p) { return p << 1; } // same as binary heap operations
		private int right(int p) { return (p << 1) + 1; }

		private void build(int p, int L, int R) {
			if (L == R)                            // as L == R, either one is fine
				st[p] = A[L];                       // store the values
			else {                                // recursively compute the values
				build(left(p) , L              , (L + R) / 2);
				build(right(p), (L + R) / 2 + 1, R          );
				long v1 = st[left(p)], v2 = st[right(p)];
				st[p] = Math.max(v1, v2);
			} }

		private long rMq(int p, int L, int R, int i, int j) {          // O(log n)
			if (i >  R || j <  L) return Long.MIN_VALUE;  // current segment outside query range
			if (L >= i && R <= j) return st[p];           // inside query range

			// compute the min values in the left and right part of the interval
			long v1 = rMq(left(p) , L              , (L+R) / 2, i, j);
			long v2 = rMq(right(p), (L+R) / 2 + 1, R          , i, j);

			return Math.max(v1, v2);           // as as in build routine
		}

		private long update_point(int p, int L, int R, int idx, long new_value) {
			// this update code is still preliminary, i == j
			// must be able to update range in the future!
			int i = idx, j = idx;

			// if the current interval does not intersect 
			// the update interval, return this st node value!
			if (i > R || j < L)
				return st[p];

			// if the current interval is included in the update range,
			// update that st[node]
			if (L == i && R == j) {
				A[i] = new_value; // update the underlying array
				return st[p] = A[L]; // this index
			}

			// compute the minimum value in the 
			// left and right part of the interval
			long v1, v2;
			v1 = update_point(left(p) , L              , (L + R) / 2, idx, new_value);
			v2 = update_point(right(p), (L + R) / 2 + 1, R          , idx, new_value);

			// return the position where the overall minimum is
			return st[p] = Math.max(v1, v2);
		}

		public SegmentTreeMax(long[] _A) {
			A = _A; n = A.length;                   // copy content for local usage
			st = new long[4 * n];
			for (int i = 0; i < 4 * n; i++) st[i] = 0; // create vector with length `len' and fill it with zeroes
			build(1, 0, n - 1);                         // recursive build
		}

		public long rMq(int i, int j) { return rMq(1, 0, n - 1, i, j); } // overloading

		public long update_point(int idx, long new_value) {
			return update_point(1, 0, n - 1, idx, new_value); }
	}
	
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}