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.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;

public class C {

	static int N;
	static int next[];
	static final boolean debug = false;
	public static void main(String[] args) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);
		
		int T = in.nextInt();
		for(int runs = 1; runs <= T; runs++) {
			N = in.nextInt();
			next = new int[N];
			for(int i = 0; i < N; i++) {
				int x = in.nextInt();
//				int x = -1;
				if(x == -1) next[i] = x;
				else next[i] = x-1;
			}
			
			SegTree st = new SegTree(N);
			for(int i = 0; i < N; i++) {
				if(next[i] == -1) continue;
				if(next[i] != i+1) {
					st.add(i, i+1, next[i]-1);
				}
				if(next[i] != N) {
					st.add(next[i], i, next[i]-1);
				}
			}
			//Now we topsorto boys

			int[] perm = st.topsort();
			if(perm == null) {
				out.println(-1);
			}
			else {
				for(int i = 0; i < N; i++) out.print((N-perm[i])+" ");
				out.println();
			}
			
//			System.out.println("Done");
			
			

		}
		out.close();
	}
	
	static class SegTree{
		int[] l,r;
		IntList to[];
		int cntIn[];
		int n;
		int indexToNode[];
		int curIndexNode;
		int topo[];
		
		public SegTree(int nn) {
			n=nn;
			l = new int[4*n+2];
			r = new int[4*n+2];
			to = new IntList[4*n+2];
			cntIn = new int[4*n+2];
			indexToNode = new int[n];
			create(1,0,n-1);
		}
		void create(int i, int ll, int rr) {
			l[i]=ll;
			r[i]=rr;
			if(debug)System.out.println("Create: "+i+"   "+ll+" "+rr);
			if(ll==rr) {
				indexToNode[ll] = i;
				to[i] = new IntList();
				return;
			}
			else {
				int mid = (ll+rr)/2;
				create(i<<1, ll, mid);
				create((i<<1)+1, mid+1, rr);
				cntIn[i<<1]++;
				cntIn[(i<<1)+1]++;
			}
		}
		void add(int index, int ll, int rr) {
			if(debug)System.out.println(index+"  -> "+ll+" "+rr);
			curIndexNode = indexToNode[index];
			addEdge(1,ll,rr);
		}
		void addEdge(int i, int ll, int rr) {
			if(l[i] >= ll && r[i] <= rr) {
				to[curIndexNode].add(i);
				if(debug)System.out.println("Edge: "+curIndexNode+" -> "+i);
				cntIn[i]++;
				return;
			}
			if(l[i] > rr || r[i] < ll) return;
			addEdge(i<<1, ll, rr);
			addEdge((i<<1)+1, ll, rr);
		}
		
		int[] topsort(){
			int topoId = 0;
			topo = new int[n];
			queue q = new queue(4*n+1);
			q.add(1);
			
			while(!q.isEmpty()) {
				int v = q.poll();
				if(debug) {
					System.out.println("V: "+v);
				}
				if(l[v] == r[v]) {
					topo[l[v]] = topoId++;
					
					for(int i = 0; i < to[v].n; i++) {
						int t = to[v].a[i];
						cntIn[t]--;
						if(cntIn[t] == 0) q.add(t);
					}
				}
				else {
					cntIn[v<<1]--;
					cntIn[(v<<1)+1]--;
					if(cntIn[v<<1] == 0) q.add(v<<1);
					if(cntIn[(v<<1)+1] == 0) q.add((v<<1)+1);
				}
				
			}
			
			if(topoId != n) return null;
			return topo;
		}
	}

	
	static class queue{
		int q[],x;
		public queue(int n) {
			q = new int[n];
			x = 0;
		}
		void add(int a) {
			q[x++] = a;
		}
		int poll() {
			return q[--x];
		}
		boolean isEmpty() { return x == 0;}
	}
	
	static class IntList {
		static int[] EMPTY = {};
		int n = 0, a[] = EMPTY;
		void add(int v) {
			if (n >= a.length)
				a = Arrays.copyOf(a, (n << 2) + 8);
			a[n++] = v;
		}
		int get(int idx) { return a[idx]; }
		int size() { return n; }
	}
	
	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;
		
		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}
		
		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}
		
		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}				
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}
		
		public int nextInt() {
			return (int)nextLong();
		}
		
		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}
		
		public double nextDouble() {
		    while(c!='.'&&c!='-'&&(c <'0' || c>'9')) c = nextChar();
		    boolean neg = c=='-';
		    if(neg)c=nextChar();
		    boolean fl = c=='.';
		    double cur = nextLong();
		    if(fl) return neg ? -cur/num : cur/num;
		    if(c == '.') {
			double next = nextLong();
			return neg ? -cur-next/num : cur+next/num;
		    }
		    else return neg ? -cur : cur;
		}
		
		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}
		
		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
	
}