You are given an integer $n$ and an array $a_1, a_2, \ldots, a_n$. You should reorder the elements of the array $a$ in such way that the sum of $\textbf{MEX}$ on prefixes ($i$-th prefix is $a_1, a_2, \ldots, a_i$) is maximized.

Formally, you should find an array $b_1, b_2, \ldots, b_n$, such that the sets of elements of arrays $a$ and $b$ are equal (it is equivalent to array $b$ can be found as an array $a$ with some reordering of its elements) and $\sum\limits_{i=1}^{n} \textbf{MEX}(b_1, b_2, \ldots, b_i)$ is maximized.

$\textbf{MEX}$ of a set of nonnegative integers is the minimal nonnegative integer such that it is not in the set.

For example, $\textbf{MEX}(\{1, 2, 3\}) = 0$, $\textbf{MEX}(\{0, 1, 2, 4, 5\}) = 3$.


-----Input-----

The first line contains a single integer $t$ $(1 \le t \le 100)$  — the number of test cases.

The first line of each test case contains a single integer $n$ $(1 \le n \le 100)$.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ $(0 \le a_i \le 100)$.


-----Output-----

For each test case print an array $b_1, b_2, \ldots, b_n$  — the optimal reordering of $a_1, a_2, \ldots, a_n$, so the sum of $\textbf{MEX}$ on its prefixes is maximized.

If there exist multiple optimal answers you can find any.


-----Examples-----

Input
3
7
4 2 0 1 3 3 7
5
2 2 8 6 9
1
0
Output
0 1 2 3 4 7 3 
2 6 8 9 2 
0


-----Note-----

In the first test case in the answer $\textbf{MEX}$ for prefixes will be:

$\textbf{MEX}(\{0\}) = 1$

$\textbf{MEX}(\{0, 1\}) = 2$

$\textbf{MEX}(\{0, 1, 2\}) = 3$

$\textbf{MEX}(\{0, 1, 2, 3\}) = 4$

$\textbf{MEX}(\{0, 1, 2, 3, 4\}) = 5$

$\textbf{MEX}(\{0, 1, 2, 3, 4, 7\}) = 5$

$\textbf{MEX}(\{0, 1, 2, 3, 4, 7, 3\}) = 5$

The sum of $\textbf{MEX} = 1 + 2 + 3 + 4 + 5 + 5 + 5 = 25$. It can be proven, that it is a maximum possible sum of $\textbf{MEX}$ on prefixes.

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = [0] * 101
	for i in l:
		ans[i] += 1
	for i in range(101):
		if ans[i] != 0:
			print(i, end=' ')
			ans[i] -= 1
	for i in range(101):
		if ans[i] == 0:
			continue
		for j in range(ans[i]):
			print(i, end=' ')
	print()


for _ in range(int(input())):
	input()
	arr = sorted(list(map(int, input().split())))
	temp = ''
	temp1 = ''
	for a in arr:
		if str(a) not in temp:
			temp += str(a) + ' '
		else:
			temp1 += str(a) + ' '
	print(temp + temp1)


import math
from collections import deque
import sys
sys.setrecursionlimit(10 ** 4)

def Divisors(n):
	l = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def Factors(n):
	result = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if i == n / i:
				result.append(i)
			else:
				result.append(i)
				result.append(n // i)
	result.append(1)
	return result

def maxSubArraySum(a):
	max_so_far = 0
	max_ending_here = 0
	size = len(a)
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < abs(max_ending_here):
			max_so_far = max_ending_here
	return max_so_far

def longestsubarray(arr, n, k):
	current_count = 0
	max_count = 0
	for i in range(0, n, 1):
		if arr[i] % k != 0:
			current_count += 1
		else:
			current_count = 0
		max_count = max(current_count, max_count)
	return max_count

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a / gcd(a, b) * b

def is_val(h, m, h1, m1):
	s1 = str(h1)
	s2 = str(m1)
	s3 = ''
	s4 = ''
	for i in s1:
		if i not in ['0', '1', '2', '5', '8']:
			return False
	for i in s2:
		if i not in ['0', '1', '2', '5', '8']:
			return False
	for i in s1:
		if i in ['0', '1', '8']:
			s3 += i
		elif i == '2':
			s3 += '5'
		else:
			s3 += '2'
	for i in s2:
		if i in ['0', '1', '8']:
			s4 += i
		elif i == '2':
			s4 += '5'
		else:
			s4 += '2'
	if int(s3[::-1]) < m and int(s4[::-1]) < h:
		return True
	else:
		return False

def main():
	n = int(input())
	l = list(map(int, input().split()))
	f = [-1 for i in range(0, n)]
	d = {}
	l.sort()
	for i in l:
		d[i] = 0
	for i in l:
		d[i] += 1
	f = 0
	while f == 0:
		for j in d:
			if d[j] > 0:
				print(j, end=' ')
				d[j] -= 1
		f = 1
		for j in d:
			if d[j] > 0:
				f = 0
				break
	print()
t = int(input())
for i in range(0, t):
	main()


import sys
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def case():
	n = IN()
	a = LI()
	d = Counter(a)
	i = 0
	while n:
		if d[i]:
			print(i, end=' ')
			d[i] -= 1
			n -= 1
		i += 1
		i %= 101
	print()
for _ in range(IN()):
	case()


for i in range(int(input())):
	n = int(input())
	b = [0 for i in range(101)]
	a = [int(i) for i in input().split()]
	for i in a:
		b[i] += 1
	for i in range(101):
		if b[i] > 0:
			print(i, end=' ')
			b[i] -= 1
	for i in range(101):
		for j in range(b[i]):
			print(i, end=' ')
	print()


t = int(input())
for z in range(t):
	n = int(input())
	inp = [int(i) for i in input().split()]
	freq = {}
	answer = []
	for i in inp:
		if i in freq:
			freq[i] += 1
		else:
			freq[i] = 1
	for i in range(101):
		if i in freq:
			answer.append(i)
			freq[i] -= 1
	for i in range(101):
		if i in freq:
			while freq[i] >= 1:
				answer.append(i)
				freq[i] -= 1
	for i in answer:
		print(i, end=' ')
	print()


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	dic = defaultdict(int)
	for i in l:
		dic[i] += 1
	sort = sorted(dic)
	while dic:
		for i in sort:
			if i in dic:
				print(i, end=' ')
				dic[i] -= 1
				if dic[i] == 0:
					del dic[i]
	else:
		print()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = [0] * 101
	for i in a:
		c[i] += 1
	for i in range(101):
		if c[i] > 0:
			print(i, end=' ')
			c[i] -= 1
	for i in range(101):
		while c[i] > 0:
			print(i, end=' ')
			c[i] -= 1
	print()


try:
	for _ in range(int(input())):
		x = int(input())
		a = list(map(int, input().split()))
		b = list(set(a))
		b.sort()
		for i in b:
			for j in a:
				if i == j:
					a.remove(i)
					break
		st = ''
		for i in b:
			st = st + str(i) + str(' ')
		for j in a:
			st = st + str(j) + str(' ')
		print(st)
except:
	pass


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	x = []
	y = []
	for i in l:
		if i not in x:
			x.append(i)
		else:
			y.append(i)
	for i in sorted(x):
		print(i, end=' ')
	for j in sorted(y):
		print(j, end=' ')
	print('\n', end='')


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def multi():
	return map(int, input().split())

def strmulti():
	return map(str, inp().split())

def lis():
	return list(map(int, inp().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = lis()
	hashy = {}
	for i in a:
		if i not in hashy:
			hashy[i] = 1
		else:
			hashy[i] += 1
	b = set(a)
	c = list(b)
	c.sort()
	for i in c:
		print(i, end=' ')
	rema = []
	for i in b:
		if hashy[i] > 1:
			for j in range(hashy[i] - 1):
				rema.append(i)
	for i in rema:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().strip().split()))
	x = list(set(a))
	x.sort()
	for y in x:
		a[a.index(y)] = -1
	for w in x:
		print(w, end=' ')
	for q in a:
		if q != -1:
			print(q, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	arr.sort()
	nums = []
	rep = []
	f = ''
	for num in arr:
		if num not in nums:
			f += str(num) + ' '
			nums.append(num)
		else:
			rep.append(num)
	for num in rep:
		f += str(num) + ' '
	print(f)


t = int(input())
for _ in range(t):
	n = int(input())
	a = sorted(list(map(int, input().split())))
	s = []
	print(a[0], end=' ')
	for i in range(1, n):
		if a[i] == a[i - 1]:
			s.append(a[i])
		else:
			print(a[i], end=' ')
	for i in s:
		print(i, end=' ')
	print()


T = int(input())
for x in range(T):
	n = int(input())
	a = [int(y) for y in input().split()]
	a1 = list(set(a))
	a1.sort()
	for z in a1:
		a.remove(z)
	for p in a1:
		print(p, end=' ')
	for q in a:
		print(q, end=' ')
	print()


import sys
from collections import defaultdict, Counter as CC
from math import sqrt, ceil, floor, log2
INF = float('inf')
MOD = 10 ** 9 + 7
read = lambda : [int(s) for s in sys.stdin.readline().split()]

def solve():
	(n,) = read()
	a = read()
	d = [0] * 101
	for i in a:
		d[i] += 1
	for i in range(101):
		if d[i] > 0:
			d[i] -= 1
			print(i, end=' ')
	for i in range(101):
		if d[i] > 0:
			for j in range(d[i]):
				print(i, end=' ')
	print()
_ = 1
_ = int(input())
while _:
	solve()
	_ -= 1


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split(' ')]
	l = sorted(l)
	ml = []
	for i in range(0, n):
		if i == 0:
			print(l[i], end=' ')
		elif l[i] == l[i - 1]:
			ml.append(l[i])
		else:
			print(l[i], end=' ')
	for i in ml:
		print(i, end=' ')
	print()


tests = int(input())
for _ in range(tests):
	n = int(input())
	numbers = sorted(map(int, input().split()))
	read = dict.fromkeys(numbers)
	for i in read.keys():
		print(i, end=' ')
	for i in range(n):
		number = numbers[i]
		if read[number] is None:
			read[number] = 0
		read[number] = read[number] + 1
	for (key, value) in read.items():
		if value > 1:
			answer = [key] * (value - 1)
			print(*answer, end=' ')
	print()


def dedup(lst):
	mx = max(lst) + 1
	dupcnt = 0
	delcnt = 0
	start = 0
	for i in range(1, len(lst) + 1):
		if i == len(lst) or lst[i] != lst[start]:
			lst[start - delcnt] = lst[start] + dupcnt * mx
			delcnt += dupcnt
			start = i
			dupcnt = 0
		else:
			dupcnt += 1
	dupidx = len(lst) - delcnt
	for i in range(0, len(lst) - delcnt):
		dupcnt = lst[i] // mx
		if dupcnt:
			lst[i] %= mx
			for j in range(dupidx, dupidx + dupcnt):
				lst[j] = lst[i]
			dupidx += dupcnt
	return lst
t = int(input())
while t > 0:
	n = int(input())
	lst = [int(x) for x in input().split()]
	lst.sort()
	lst2 = dedup(lst)
	for i in range(n):
		print(lst2[i], end=' ')
	print(end='\n')
	t -= 1


def Solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = {}
	c = []
	for i in range(len(a)):
		if b.get(a[i]) != None:
			c.append(a[i])
		else:
			b[a[i]] = 1
			print(a[i], end=' ')
	for i in c:
		print(i, end=' ')
	print()
q = int(input())
while q:
	Solve()
	q -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	res = []
	print(a[0], end=' ')
	for i in range(1, n):
		if a[i] == a[i - 1]:
			res.append(a[i])
		else:
			print(a[i], end=' ')
	for i in res:
		print(i, end=' ')
	print()


t = int(input())
for asasd in range(t):
	n = int(input())
	con = [int(i) for i in input().split()]
	res = []
	sobr = []
	con.sort()
	for i in con:
		if i in res:
			sobr.append(i)
		else:
			res.append(i)
	res.extend(sobr)
	for i in res:
		print(i, end=' ')
	print('')


t = int(input())
for _ in range(t):
	n = int(input())
	numbers = [int(x) for x in input().split()]
	numbers = sorted(numbers)
	new_set = []
	left_out = []
	for num in numbers:
		if num not in new_set:
			new_set.append(num)
		else:
			left_out.append(num)
	for num in new_set:
		print(num, end=' ')
	for num in left_out:
		print(num, end=' ')
	print()


x = int(input(''))
for i in range(x):
	l = []
	a = int(input(''))
	p = input('').split(' ')
	for j in range(a):
		l.append(int(p[j]))
	l.sort()
	print(l[0], end=' ')
	q = []
	for k in range(1, a):
		if l[k] != l[k - 1]:
			print(l[k], end=' ')
		else:
			q.append(l[k])
	for r in q:
		print(r, end=' ')
	print()


for i in range(int(input())):
	lenn = int(input())
	list1 = list(map(int, input().split()))
	count = [0] * 101
	ans = ''
	for i in list1:
		count[i] += 1
	for i in range(101):
		if count[i] > 0:
			ans += str(i) + ' '
			count[i] -= 1
	for i in range(101):
		for j in range(count[i]):
			ans += str(i) + ' '
	print(ans)


t = int(input())
while t:
	t -= 1
	n = int(input())
	ans = 0
	arr = list(map(int, input().split()))
	hash_map = {}
	for i in arr:
		if i in hash_map:
			hash_map[i] += 1
		else:
			hash_map[i] = 0
	arr_set = list(set(arr))
	arr_set.sort()
	for i in hash_map:
		if hash_map[i]:
			arr_set += [i] * hash_map[i]
	for i in arr_set:
		print(str(i), end=' ')
	print()


while True:
	try:
		t = eval(input())
		for i in range(t):
			n = eval(input())
			a = list(map(int, input().split()))
			a.sort()
			a.insert(0, -1)
			for j in range(1, n + 1):
				if a[j - 1] != a[j]:
					print(a[j], end=' ')
			for j in range(1, n + 1):
				if a[j - 1] == a[j]:
					print(a[j], end=' ')
			print(end='\n')
	except:
		break


from collections import defaultdict

def solve():
	n = int(input())
	a = [int(x) for x in input().split()]
	d = defaultdict(lambda : 0)
	for x in a:
		d[x] += 1
	l = list(set(a))
	l.sort()
	x = len(l)
	i = 0
	check = True
	while True:
		if d[l[i]] != 0:
			d[l[i]] -= 1
			print(l[i], end=' ')
			check = False
		if i == x - 1:
			if check:
				break
			else:
				check = True
		i = (i + 1) % x
	print()
t = int(input())
while t:
	t -= 1
	solve()


cases = int(input())
for i in range(cases):
	length = int(input())
	array = input().split(' ')
	array = list(map(int, array))
	array.sort()
	lastnum = -1
	repetednums = []
	finalarray = []
	for k in range(length):
		if lastnum != array[k]:
			finalarray.append(array[k])
			lastnum = array[k]
		else:
			repetednums.append(array[k])
	finalarray = finalarray + repetednums
	finalarraystring = ''
	for m in range(length):
		finalarraystring += str(finalarray[m]) + ' '
	print(finalarraystring)


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	nw = []
	print(l[0], end=' ')
	for i in range(1, len(l), 1):
		if l[i] != l[i - 1]:
			print(l[i], end=' ')
		else:
			nw.append(l[i])
	for i in range(len(nw)):
		print(nw[i], end=' ')
	print('\n', end='')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	b = [0] * 101
	for i in a:
		b[i] += 1
	for i in range(101):
		if b[i]:
			print(i, end=' ')
			b[i] -= 1
	for i in range(101):
		while b[i]:
			print(i, end=' ')
			b[i] -= 1
	print()


user_input = int(input())
for i in range(user_input):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	b = [0] * n
	b[0] = a[0]
	c = 0
	for i in range(1, n):
		if a[i] == a[i - 1]:
			c += 1
	j = n - c
	k = 1
	for i in range(1, n):
		if a[i] == a[i - 1]:
			b[j] = a[i]
			j += 1
		else:
			b[k] = a[i]
			k += 1
	s = ''
	for i in b:
		s += str(i) + ' '
	print(s)


import sys
input = sys.stdin.readline
t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	arr = [0 for i in range(105)]
	for i in range(n):
		arr[li[i]] += 1
	for i in range(105):
		if arr[i]:
			print(i, end=' ')
			arr[i] -= 1
	for i in range(105):
		for j in range(arr[i]):
			print(i, end=' ')
	print()


def Sort(sub_li):
	return sorted(sub_li, key=lambda x: x[1])
import math
n = int(input())
for i in range(0, n):
	o = int(input())
	p = input().rstrip().split(' ')
	L = [0] * 101
	L = list(L)
	for j in range(0, len(p)):
		L[int(p[j])] += 1
	for j in range(0, len(L)):
		A = j
		B = L[j]
		if B > 0:
			print(A, end=' ')
		L[j] -= 1
	for j in range(0, len(L)):
		A = j
		for k in range(0, L[j]):
			print(A, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	x = input().split()
	lst = [int(_) for _ in x]
	lst.sort()
	left = []
	front = []
	front.append(lst[0])
	for i in range(1, n):
		if lst[i] != lst[i - 1]:
			front.append(lst[i])
		else:
			left.append(lst[i])
	for x in front:
		print(x, end=' ')
	for x in left:
		print(x, end=' ')
	print()