Chef has $N$ markers. There is a cap on each marker. For each valid $i$, the $i$-th marker has colour $a_i$. Initially, for each valid $i$, the colour of the cap on the $i$-th marker is also $a_i$.
Chef wants to rearrange the caps in such a way that no marker has the same colour as its cap. (Obviously, each marker must have exactly one cap.) Can he do that? If he can, find one such way to rearrange the caps. If there are multiple solutions, you may find any one.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $a_1, a_2, \ldots, a_N$.

-----Output-----
- For each test case:
- If Chef cannot successfully rearrange the caps, print a single line containing the string "No" (without quotes).
- Otherwise, print two lines. The first line should contain the string "Yes" (without quotes). The second line should contain $N$ space-separated integers describing a valid rearrangement of caps. For each valid $i$, the $i$-th of these integers should denote the final colour of the cap on the $i$-th marker.

-----Constraints-----
- $1 \le T \le 10$
- $1 \le N \le 10^5$
- $1 \le a_i \le 10^9$ for each valid $i$

-----Example Input-----
2
9
1 1 1 2 2 2 3 3 3
2
1 1

-----Example Output-----
Yes
2 2 2 3 3 3 1 1 1
No

Difficulty: HARD

Solutions:
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	f = {}
	poss = 1
	A = [[a[i], i] for i in range(n)]
	for i in range(n):
		if a[i] in f:
			f[a[i]] += 1
		else:
			f[a[i]] = 1
	for i in f.values():
		if i > n // 2:
			poss = 0
	if poss:
		A.sort()
		ans = [0] * n
		j = max(f.values())
		B = A[j:] + A[:j]
		for i in range(n):
			ans[A[i][1]] = B[i][0]
		print('Yes')
		print(*ans)
	else:
		print('No')


t = int(input())
for i in range(t):
	n = int(input())
	hash = {}
	l = list(map(int, input().split()))
	for j in range(n):
		try:
			hash[l[j]]
		except:
			hash[l[j]] = 1
		else:
			hash[l[j]] += 1
	flag = 0
	max = 0
	for j in range(n):
		if hash[l[j]] > n // 2:
			flag = 1
			break
		elif hash[l[j]] > max:
			max = hash[l[j]]
	v = sorted(range(len(l)), key=lambda k: l[k])
	u = sorted(l)
	ans = [0] * n
	if flag == 0:
		print('Yes')
		z = u[max:] + u[:max]
		for i in range(n):
			ans[v[i]] = z[i]
		print(*ans)
	else:
		print('No')


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	li = [int(x) for x in input().split()]
	inp_ord = list(enumerate(li))
	cow = Counter(li)
	max_freq = cow.most_common(1)[0][1]
	if max_freq > n - max_freq:
		print('No')
	else:
		sorted_input = sorted(inp_ord, key=lambda x: x[1])
		foo = n - max_freq
		for i in range(foo):
			current_element = sorted_input[i][1]
			curr_pos = sorted_input[i][0]
			toSwapIndex = i + max_freq
			swap_partner = sorted_input[toSwapIndex][1]
			swap_position = sorted_input[toSwapIndex][0]
			sorted_input[i] = (curr_pos, swap_partner)
			sorted_input[toSwapIndex] = (swap_position, current_element)
		op_list = sorted(sorted_input, key=lambda x: x[0])
		bar = [y for (x, y) in op_list]
		print('Yes')
		print(*bar)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = a[:]
	sa = set(a)
	ss1 = list(sa)
	gg = defaultdict(list)
	dic = {}
	for i in ss1:
		dic[i] = 0
	for i in range(n):
		dic[b[i]] += 1
		gg[b[i]].append(i)
	flg = 0
	for k in dic:
		if dic[k] > n // 2:
			flg = 1
			break
	ma = 0
	if flg:
		print('No')
	else:
		for k in dic:
			ma = max(ma, dic[k])
		c = []
		e = []
		d = [0 for i in range(n)]
		for k in gg:
			c += gg[k]
		e = c[ma:] + c[:ma]
		for i in range(n):
			d[c[i]] = b[e[i]]
		print('Yes')
		print(*d)