You are given an array A of N integers A_{1}, A_{2}, \ldots, A_{N}. Determine if there are two [permutations] B and C of this array, for which the following condition is satisfied:

* There doesn't exist a pair of integers (i, j) such that 1 ≤ i ≤ j ≤ N and (i, j) \neq (1, N), for which the subarray B[i:j] is a permutation of subarray C[i:j].

If there exist such permutations, find any of them.

As a reminder, B[i:j] refers to the subarray [B_{i}, B_{i+1}, \ldots, B_{j}]

------ Input Format ------ 

- The first line of the input contains a single integer T, the number of test cases. The description of the test cases follows.
- The first line of each test case contains a single integer N — the number of integers.
- The second line of each test case contains N space-separated integers A_{1}, A_{2}, \ldots, A_{N}.

------ Output Format ------ 

For each test case, if there are no such permutations B and C, output NO.

Otherwise, on the first line output YES. In the next line, output N integers B_{1}, B_{2}, \ldots, B_{N}. In the next line, output N integers C_{1}, C_{2}, \ldots, C_{N}.

You may print each character of YES/NO in either uppercase or lowercase (for example, the strings YES, yeS, YeS, and yEs will all be treated as identical).

------ Constraints ------ 

$1 ≤T ≤100$
$3 ≤N ≤1000$
$0 ≤A_{i} ≤10^{9}$
- The sum of $N$ over all test cases doesn't exceed $2000$.

----- Sample Input 1 ------ 
3
3
1 1 2
4
19 39 19 84
6
1 2 3 1 2 3
----- Sample Output 1 ------ 
NO
YES
19 19 39 84 
39 84 19 19 
YES
1 1 2 2 3 3 
2 3 3 1 1 2 
----- explanation 1 ------ 
Test case $1$: There are $3 \times 3 = 9$ pairs of permutations of the given array. Here's why they're all bad:
- If $B = [1, 1, 2]$ and $C = [1, 1, 2]$, $B[1:1] = C[1:1]$
- If $B = [1, 1, 2]$ and $C = [1, 2, 1]$, $B[1:1] = C[1:1]$
- If $B = [1, 1, 2]$ and $C = [2, 1, 1]$, $B[2:2] = C[2:2]$
- If $B = [1, 2, 1]$ and $C = [1, 1, 2]$, $B[1:1] = C[1:1]$
- If $B = [1, 2, 1]$ and $C = [1, 2, 1]$, $B[1:1] = C[1:1]$
- If $B = [1, 2, 1]$ and $C = [2, 1, 1]$, $B[3:3] = C[3:3]$
- If $B = [2, 1, 1]$ and $C = [1, 1, 2]$, $B[2:2] = C[2:2]$
- If $B = [2, 1, 1]$ and $C = [1, 2, 1]$, $B[3:3] = C[3:3]$
- If $B = [2, 1, 1]$ and $C = [2, 1, 1]$, $B[1:1] = C[1:1]$

Difficulty: HARD

Solutions:
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		d[i] = d.get(i, 0) + 1
	mx = 0
	for i in d.values():
		if i >= mx:
			mx = i
	if len(d) == 2:
		print('NO')
	elif n % 2 == 0:
		if mx <= n // 2:
			print('YES')
			l.sort()
			for i in range(n):
				print(l[i], end=' ')
			print()
			for i in range(n // 2, n):
				print(l[i], end=' ')
			print(end='')
			for i in range(0, n // 2):
				print(l[i], end=' ')
			print()
		else:
			print('NO')
	elif mx < n // 2 + 1:
		print('YES')
		l.sort()
		for i in range(n):
			print(l[i], end=' ')
		print()
		for i in range(n // 2 + 1, n):
			print(l[i], end=' ')
		print(end='')
		for i in range(0, n // 2 + 1):
			print(l[i], end=' ')
		print()
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = input().split()
	d = {}
	for i in l:
		i = int(i)
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	l = []
	for i in d:
		l.append([i, d[i]])
	if len(l) == 1:
		print('NO')
	elif len(l) == 2:
		if l[0][0] == l[1][0] and (l[0][1] == 1 or l[0][1] == 2):
			print('YES')
			s = str(l[0][0]) * l[0][1] + str(l[1][0]) * l[0][1]
		else:
			print('NO')
	else:
		le = n // 2
		ma = l[0][1]
		s = []
		for i in l:
			s[len(s):] = [i[0]] * i[1]
			if i[1] > ma:
				ma = i[1]
		if ma > le:
			print('NO')
		else:
			print('YES')
			for i in s:
				print(i, end=' ')
			print()
			s = s[le:] + s[0:le]
			for i in s:
				print(i, end=' ')
			print()


def Print(arr):
	for ele in arr:
		print(ele, end=' ')
	print()
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	ar = arr[n // 2:]
	for i in range(n // 2):
		ar.append(arr[i])
	ans = True
	for i in range(n):
		if arr[i] == ar[i]:
			ans = False
			break
	d = {}
	for ele in arr:
		d[ele] = d.get(ele, 0) + 1
	if len(d) == 2:
		tm = []
		for ele in d:
			tm.append(d[ele])
		if tm[0] == tm[1]:
			ans = False
	if ans:
		print('YES')
		Print(arr)
		Print(ar)
	else:
		print('NO')