t=int(input())
for _ in range(t):
number=int(input())
arr=list(map(int,input().split()))
arrL,arrR,dic,maxx,maxx2=[],[],{},0,0
for num in arr:
if num in dic:
dic[num]+=1
arrL.append(num)
else:
dic[num]=1
arrR.append(num)
maxx=max(maxx,num)
for k,v in dic.items():
if v>2:
maxx2=v
break
if dic[maxx]>1 or maxx2>2:
print(-1)
else:
arrL.sort()
arrR.sort(reverse=True)
ans=arrL+arrR
print(*ans)
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |