The chef is having one array of N natural numbers(numbers may be repeated). i.e. All natural numbers must be less than N. Chef wants to rearrange the array and try to place a natural number on its index of the array, i.e array[i]=i. If multiple natural numbers are found for given index place one natural number to its index and ignore others.i.e. arr[i]=i and multiple i found in array ignore all remaining i's If any index in the array is empty place 0 at that place. i.e. if for arr[i], i is not present do arr[i]=0.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains two lines of input.
- First-line has $N$ denoting the size of an array.
- Second-line has $N$ space-separated natural numbers.

-----Output:-----
For each test case, output in a single line with the new rearranged array.

-----Constraints-----
- $1 \leq T \leq 10^3$
- $2 \leq N \leq 10^3$
- $arr[i] \leq N-1$

-----Sample Input:-----
2
2
1 1
4
1 1 2 1

-----Sample Output:-----
0 1
0 1 2 0

-----EXPLANATION:-----
For 1) $1$ occurs twice in the array hence print 0 at 0th index and 1 at 1st index
For 2) $1$ occurs thrice and 2 once in the array hence print 0 at 0th index and 1 at 1st index, 2 at 2nd index and 0 at 3rd index.

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d = set()
	for i in arr:
		d.add(i)
	for i in range(n):
		if i in d:
			print(i, end=' ')
		else:
			print(0, end=' ')
	print()


for t in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	x.sort()
	x = [i if i in x else 0 for i in range(n)]
	print(*x)


test = input()
for i in range(int(test)):
	N = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(N):
		if i in arr:
			ans.append(i)
		else:
			ans.append(0)
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(len(l)):
		if l[i] >= i:
			l[i] = i
		else:
			l[i] = 0
	print(*l)


for _ in range(int(input())):
	lens = int(input())
	has = set([int(x) for x in input().split()])
	rets = [0] * lens
	for i in range(lens):
		if i in has:
			rets[i] = i
	print(*rets)


n = input()
for i in range(int(n)):
	k = int(input())
	l = list(map(int, input().split()))
	f = []
	for i in range(k):
		if i in l:
			f.append(i)
		else:
			f.append(0)
	print(*f)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = []
	for i in range(n):
		if i in a:
			ans.append(i)
		else:
			ans.append(0)
	print(*ans)


for i in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	lst1 = [i for i in range(n)]
	dict1 = {}.fromkeys(lst1, 0)
	for key in lst:
		dict1[key] += 1
	for key in dict1:
		if dict1[key] > 0:
			print(key, end=' ')
		else:
			print(0, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	p = []
	for i in range(n):
		p.insert(i - 1, 0)
	for i in set(l):
		p[i] = i
	for i in p:
		print(i, end=' ')
	print(end='\n')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = list(set(l))
	m.sort()
	k = []
	for i in range(n):
		if i in m:
			k.append(i)
		else:
			k.append(0)
	print(*k)


from collections import Counter
try:
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		d = dict(Counter(a))
		new = []
		for i in range(0, n):
			if i in d:
				new.append(i)
			else:
				new.append(0)
		print(*new)
except:
	pass


t = int(input())
while t:
	n = int(input())
	A = list(map(int, input().strip().split(' ')))
	A = set(A)
	m = max(A)
	B = [0] * n
	for ele in A:
		if B[ele] == 0:
			B[ele] = 1
		else:
			pass
	for j in range(len(B)):
		if B[j] == 0:
			print(0, end=' ')
		else:
			print(j, end=' ')
	print()
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	a = list(set(arr))
	for i in range(n):
		if i in a:
			arr[i] = i
			a.remove(i)
		else:
			arr[i] = 0
	print(*arr)


testcases = int(input())
for i in range(testcases):
	n = int(input())
	x = [int(y) for y in input().split()]
	l = [0] * n
	for i in range(n):
		l[x[i]] += 1
	for i in range(n):
		if l[i] > 0:
			print(i, end=' ')
		else:
			print(0, end=' ')
	print()


T = int(input())
for i in range(T):
	N = int(input())
	l1 = [int(i) for i in input().split()]
	for i in range(N):
		if i in l1:
			print(i, end=' ')
		else:
			print(0, end=' ')
	else:
		print()


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	for i in range(0, n):
		if i in lst:
			lst[i] = i
		else:
			lst[i] = 0
	for i in range(0, n):
		print(lst[i], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = [0 for i in range(n)]
	for i in range(n):
		m[a[i]] = a[i]
	print(*m)


try:
	t = int(input())
	for _ in range(t):
		n = int(input())
		l = [int(x) for x in input().split()]
		temp = [0] * n
		s = set()
		for ele in l:
			if ele not in s:
				s.add(ele)
		for i in range(n):
			l[i] = 0
		for i in range(0, n):
			if i in s:
				l[i] = i
		print(*l)
except EOFError:
	pass


def itguy(arr):
	for i in range(0, len(arr)):
		if arr[i] == None:
			arr[i] = 0
		elif arr[i] != 0:
			arr[i] = i
			for j in range(i + 1, len(arr)):
				if arr[j] == i:
					arr[j] = 0
	for i in arr:
		print(i, end=' ')
	print()
n = int(input())
for i in range(n):
	l = int(input())
	arr = list(map(float, input().split()))
	itguy(arr)