Problem: You are given a permutation of length n. Recall that the permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2, 3, 1, 5, 4] is a permutation, but [1, 2, 2] is not a permutation (2 appears twice in the array) and [1, 3, 4] is also not a permutation (n=3 but there is 4 in the array).

You can perform at most n-1 operations with the given permutation (it is possible that you don't perform any operations at all). The i-th operation allows you to swap elements of the given permutation on positions i and i+1. Each operation can be performed at most once. The operations can be performed in arbitrary order.

Your task is to find the lexicographically minimum possible permutation obtained by performing some of the given operations in some order.

You can see the definition of the lexicographical order in the notes section.

You have to answer q independent test cases.

For example, let's consider the permutation [5, 4, 1, 3, 2]. The minimum possible permutation we can obtain is [1, 5, 2, 4, 3] and we can do it in the following way:

  1. perform the second operation (swap the second and the third elements) and obtain the permutation [5, 1, 4, 3, 2]; 
  2. perform the fourth operation (swap the fourth and the fifth elements) and obtain the permutation [5, 1, 4, 2, 3]; 
  3. perform the third operation (swap the third and the fourth elements) and obtain the permutation [5, 1, 2, 4, 3]. 
  4. perform the first operation (swap the first and the second elements) and obtain the permutation [1, 5, 2, 4, 3]; 



Another example is [1, 2, 4, 3]. The minimum possible permutation we can obtain is [1, 2, 3, 4] by performing the third operation (swap the third and the fourth elements).

Input

The first line of the input contains one integer q (1 ≤ q ≤ 100) — the number of test cases. Then q test cases follow.

The first line of the test case contains one integer n (1 ≤ n ≤ 100) — the number of elements in the permutation.

The second line of the test case contains n distinct integers from 1 to n — the given permutation.

Output

For each test case, print the answer on it — the lexicograhically minimum possible permutation obtained by performing some of the given operations in some order.

Example

Input


4
5
5 4 1 3 2
4
1 2 4 3
1
1
4
4 3 2 1


Output


1 5 2 4 3 
1 2 3 4 
1 
1 4 3 2 

Note

Recall that the permutation p of length n is lexicographically less than the permutation q of length n if there is such index i ≤ n that for all j from 1 to i - 1 the condition p_j = q_j is satisfied, and p_i < q_i. For example:

  * p = [1, 3, 5, 2, 4] is less than q = [1, 3, 5, 4, 2] (such i=4 exists, that p_i < q_i and for each j < i holds p_j = q_j), 
  * p = [1, 2] is less than q = [2, 1] (such i=1 exists, that p_i < q_i and for each j < i holds p_j = q_j). 

Solution (in PYTHON3):

Solution:

#Q3
# for _ in range(int(input())):
# 	n = int(input())
# 	s = input()
# 	k = 1
# 	maxx = 0
# 	b = True
# 	while k<n:
# 		# print(k)
# 		for i in range(n-k+1):
# 			a = s[i:i+k]
# 			# print('a= ', a)
# 			for j in range(i+1,n-k+1):
# 				b = s[j:j+k]
# 				# print('b= ',b )
# 				if a==b:
# 					maxx = max(k,maxx)
# 		k+=1
# 	print(maxx)

# def fun1(a,ai,aj,b,bi,bj):
# 	if a[ai:aj]==b[bi:bj]:
# 		if ai!=bi:
# 			return len(a[ai:aj])
# 		else:
# 			return 0
# 	else:
# 		return fun1(a,ai+1,aj,b,bi+1,bj)
# def fun2(a,ai,aj,b,bi,bj):
# 	if a[ai:aj]==b[bi:bj]:
# 		if ai!=bi:
# 			return len(a[ai:aj])
# 		else:
# 			return 0
# 	else:
# 		return fun2(a,ai,aj-1,b,bi,bj-1)
# def fun3(a,ai,aj,b,bi,bj):
# 	if a[ai:aj]==b[bi:bj]:
# 		if ai!=bi:
# 			return len(a[ai:aj])
# 		else:
# 			return 0
# 	else:
# 		return fun3(a,ai+1,aj,b,bi,bj-1)
# def fun4(a,ai,aj,b,bi,bj):
# 	if a[ai:aj]==b[bi:bj]:
# 		if ai!=bi:
# 			return len(a[ai:aj])
# 		else:
# 			return 0
# 	else:
# 		return fun4(a,ai,aj-1,b,bi+1,bj)
# for _ in range(int(input())):
# 	n = int(input())
# 	s = input()
# 	a = s
# 	b = s
# 	print(max(fun1(a,0,n-1,b,1,n),fun2(a,0,n-1,b,1,n),fun3(a,0,n-1,b,1,n),fun4(a,0,n-1,b,1,n)))
# for _ in range(int(input())):
# 	a,b = map(int,input().split())
# 	a,b = min(a,b),max(a,b)
# 	v,w = a,b
# 	diff = b-a.
# 	c1 = 0
# 	x = 1
	# a,b = v,w
	# for i in range(1,len(op)):
	# 	x+=1
	# 	if op[i]>diff:
	# 		c1 += i-1
	# 		a+=op[i-1]
	# 		break
	# # print(c1)
	# print(a,b)
	# x-=1
	# print(x)
	# while True:
	# 	# print(a,b)
	# 	if a==b:
	# 		print(c1)
	# 		break
	# 	if b>=(a+x):
	# 		a+=x
	# 		x+=1
	# 		c1+=1
	# 	else:
	# 		b+=x
	# 		x+=1
	# 		c1+=1
	# x = 1
	# c = 0
	# a,b = v,w
	# for i in range(1,10**5+1):
	# 	if i*(i+1)//2>diff:
	# 		x = i-1
	# 		c =i-1
	# 		break
	# a += (x*(x+1)//2)
	# c+= 2*(b-a)
	# print(c)

# n,m = map(int,input().split())
# a = list(map(int,input().split()))
# b = list(map(int,input().split()))
# # a.sort()
# # b.sort()
# rem = []
# for i in range(n):
# 	rem.append((b[0]-a[i])%m)
# rem.sort()
# print(rem[0])

# n,k = map(int,input().split())
# num = list(input())
# two = num[:]
# m = n
# for i in range(0,m-k):
# 	if num[i]==num[i+k]:
# 		continue
# 	else:
# 		if int(num[i])<int(num[i+k]):
# 			num[i+k] = num[i]
# 			if(int(''.join(num))<int(''.join(two))):
# 				num[i+k-1] = str(int(num[i+k-1])+1)
# 		else:
# 			num[i+k] = num[i]
# print(m)
# print(''.join(num))

# n = int(input())
# arr = list(map(int,input().split()))
# vis1 = [False]*n
# nei1 = [[] for i in range(n)]
# nei2 = nei1[:]
# for i in range(n):
# 	if i+arr[i]<n:
# 		nei1[i].append(i+arr[i])
# 		nei1[i+arr[i]].append(i)
# 	if i-arr[i]>-1:
# 		nei2[i].append(i-arr[i])
# 		nei2[i-arr[i]].append(i)
# vis1 = [False]*n
# dis1 = [0]*n
# q = [arr[0]]
# while q:
# 	x = q.pop(0)-1
# 	for i in range(len(nei1[x])):
# 		if !vis1[nei1[x][i]]==False:
# 			if x%2==nei1[x][i]%2:
# 				dis1[nei1[x][i]] = dis1[x]+1
# 				vis1[nei1[x][i]] = True
# 				q.append(nei1[x][i])
# 			else:
# 				dis1[nei1[x][i]] = dis1[x]+1
				
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int,input().split()))
	aa = set(i for i in range(n-1))
	for i in range(n-2,-1,-1):
		if arr[i]>arr[i+1]:
			arr[i],arr[i+1] = arr[i+1],arr[i]
			aa.remove(i)
	
	for i in aa:
		if arr[i]>arr[i+1]:
			arr[i],arr[i+1] = arr[i+1],arr[i]
	print(*arr)