A permutation of length n is a sequence of integers from 1 to n of length n containing each number exactly once. For example, [1], [4, 3, 5, 1, 2], [3, 2, 1] are permutations, and [1, 1], [0, 1], [2, 2, 1, 4] are not.

There was a permutation p[1 ... n]. It was merged with itself. In other words, let's take two instances of p and insert elements of the second p into the first maintaining relative order of elements. The result is a sequence of the length 2n.

For example, if p=[3, 1, 2] some possible results are: [3, 1, 2, 3, 1, 2], [3, 3, 1, 1, 2, 2], [3, 1, 3, 1, 2, 2]. The following sequences are not possible results of a merging: [1, 3, 2, 1, 2, 3], [3, 1, 2, 3, 2, 1], [3, 3, 1, 2, 2, 1].

For example, if p=[2, 1] the possible results are: [2, 2, 1, 1], [2, 1, 2, 1]. The following sequences are not possible results of a merging: [1, 1, 2, 2], [2, 1, 1, 2], [1, 2, 2, 1].

Your task is to restore the permutation p by the given resulting sequence a. It is guaranteed that the answer exists and is unique.

You have to answer t independent test cases.

Input

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

The first line of the test case contains one integer n (1 ≤ n ≤ 50) — the length of permutation. The second line of the test case contains 2n integers a_1, a_2, ..., a_{2n} (1 ≤ a_i ≤ n), where a_i is the i-th element of a. It is guaranteed that the array a represents the result of merging of some permutation p with the same permutation p.

Output

For each test case, print the answer: n integers p_1, p_2, ..., p_n (1 ≤ p_i ≤ n), representing the initial permutation. It is guaranteed that the answer exists and is unique.

Example

Input


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


Output


1 2 
1 3 4 2 
1 2 3 4 5 
1 2 3 
2 3 4 1 
"""
ind=0
bal=True
a=0
top=''
S=str(input())
stack=[]
while(ind<len(S)):
    if(len(stack)==0):
        a=ind

    if(S[ind]=='[' or S[ind]=='{' or S[ind]=='('):
            stack.append(S[ind])
    else:
            if((S[ind]==']' or S[ind]=='}' or S[ind]==')')):
                if(len(stack)==0):
                    bal=False
                    break
                else:
                    top=stack[(len(stack)-1)]
                    stack.pop()
                    if((top=='[' and S[ind]!=']') or (top=='{' and S[ind]!='}') or (top=='(' and S[ind]!=')')):
                        bal=False
                        break
    ind=ind+1

if(bal and len(stack)==0):
    print("Success")
else:
    if(ind>=len(S) and len(stack)!=0):
        print(a+1)
    else:
        print(ind+1)"""

"""def binsrch(l,h,arr,x):
    mid=l+(h-l)//2
    if(h<l):
        return -1
    if(x==arr[mid]):
        return mid
    if(x>arr[mid]):
        return binsrch(mid+1,h,arr,x)
    else:
        return binsrch(l,mid-1,arr,x)




l=list(map(int,input().split()))
n=l[0]
a=l[1:n+1]


b=list(map(int,input().split()))



for i in range(1,len(b)):
    print(binsrch(0,n-1,a,b[i]),end=' ')
    r = 0
    le = n - 1
    ch=0
    while(r<=le):

        mid = r + (le - r) // 2;


        if a[mid] == b[i]:
            print(mid,end=' ')
            ch=1
            break


        elif a[mid] < b[i]:
            r = mid + 1


        else:
            le = mid - 1


    if(ch==0):
        print(-1, end=' ')
"""
"""def sftdn(i,arr):
    while(i<n):
        if (l[(2 * i) + 1] < l[(2 * i) + 2] and l[(2 * i) + 1] < l[i]):

            print(i, (2 * i) + 1)
            swap(l, i, (2 * i) + 1)

        elif (l[(2 * i) + 2] < l[(2 * i) + 1] and l[(2 * i) + 2] < l[i]):
            print(i, (2 * i) + 2)
            swap(l, i, (2 * i) + 2)
        elif (l[(2 * i) + 2] == l[(2 * i) + 1] and l[(2 * i) + 2] < l[i]):
            print(i, (2 * i) + 2)
            swap(l, i, (2 * i) + 2)
"""
"""ans=[]
def sftdn(i):

    minind=i
    li=(2*i)+1
    if(li<=n-1 and l[li]<l[minind]):
        minind=li
    ri=(2*i)+2
    if(ri<=n-1 and l[ri]<l[minind]):
        minind=ri
    if(i!=minind):
        swap(l,i,minind)
        ans.append(i)
        ans.append(minind)
        sftdn(minind)


def swap(arr,n1,n2):
    t=arr[n1]
    arr[n1]=arr[n2]
    arr[n2]=t



n=int(input())
ans=[]
l=list(map(int,input().split()))
for i in range (((n-1)//2),-1,-1):

    sftdn(i)"""






"""print(len(ans)//2)

for i in range(0,len(ans)-1,2):
    print(ans[i],ans[i+1])"""



"""m=1000
ht=[[] for _ in range(m)]
def hf(x,p,m):
    return ((x)%p)%m
def add(num,name,n):
    cf = 0
    hv = hf(num, p, m)
    for i in range(0, len(ht[hv]), 2):
        if (ht[hv][i] == num):
            ht[hv][i + 1] = name
            cf = 1
            n = n - 1
            return m,ht



    if(cf==0):
         ht[hf(num,p,m)].extend([num,name])
         return m,ht
def find(x):
    hv=hf(x,p,m)
    f=0
    for i in range(0,len(ht[hv]),2):
        if((ht[hv][i])==x):
            print(ht[hv][i+1])
            return
    print('not found')



p=10000019
n=0



for _ in range(int(input())):
    qr=list(map(str,input().split()))

    if(qr[0]=='add'):
        n=n+1
        m,ht= add(int(qr[1]),qr[2],n)


    elif(qr[0]=='find'):
        find(int(qr[1]))


    elif(qr[0]=='del'):
        hv1=hf(int(qr[1]),p,m)
        for i in range(0,len(ht[hv1]),2):
            if(ht[hv1][i]==int(qr[1])):
                ht[hv1].pop(i)
                ht[hv1].pop(i)
                break

    qr.clear()"""


"""t=int(input())
for _ in range(t):
    n,k=map(int,input().split())
    s=str(input())
    c=0
    l=list(s.split('1'))
    ll=len(l)

    for i in range(ll):
        le=len(l[i])
        if(le>k and len(l)!=1 and (i==0 or i==(ll-1))):
            if(i==0):

                c=c+(((le))//(k+1))
            if(i==ll-1):
                le//(k+1)
        elif(le>k and len(l)!=1 and (i>0 and i<(ll-1))):

                c = c + ((le -k) // (k+1))

        elif(len(l)==1 and n<=k):
            c=1
        elif(len(l)==1 and n>k):
            c=(le+k)//(k+1)


    print(c)"""



"""n=int(input())
c=[1,3,4]
o=1
oc=1
tc=3
t=100000
if(n>=tc):
 t=1
fc=4
f=100000
if(n>=fc):
 f=1

while(oc!=n and n>oc):

    if(n-oc>= c[2]):

        oc=oc+c[2]
        o=o+1
    elif(n-oc>=c[1]):

        oc=oc+c[1]
        o=o+1
    elif(n-oc>=c[0]):

        oc=oc+c[0]
        o=o+1



while(tc!=n and n>tc):

    if (n - tc >= c[2]):
        tc = tc + c[2]
        t = t + 1
    elif (n - tc >= c[1]):
        tc = tc + c[1]
        t = t + 1
    elif (n - tc >= c[0]):
        tc = tc + c[0]
        t = t + 1
while(fc!=n and n>fc):
    if (n - fc >= c[2]):
        fc=fc + c[2]
        f = f + 1
    elif (n - fc >= c[1]):
        fc = fc + c[1]
        f = f + 1
    elif (n - fc >= c[0]):
        fc = fc + c[0]
        f = f + 1


print(min(o,t,f))"""
"""bol=[]
W,n=map(int,input().split())
w=list(map(int,input().split()))
#w.sort(reverse=True)
w.insert(0,0)

l=[[] for _ in range(n+1)]
for i in range(n+1):
    for j in range(W + 1):
     l[i].append(0)


for i in range(1,n+1):
    for j in range(1,W+1):
        if(w[i]>j):
            l[i][j]=l[i-1][j]
        else:
            l[i][j]=max(w[i]+l[i-1][j-w[i]],l[i-1][j])
print(l[n][W])"""

"""n=int(input())
l=[]
for _ in range(n):
    li=list(map(int,input().split()))
    l.append(li)
"""
import math
import os
import random
import re
import sys
from collections import Counter
import heapq


"""try:
    


except:
    pass"""
t=int(input())
for _ in range(t):
    l=[]
    n=int(input())
    for i in range(n+1):
        l.append(0)
    p=list(map(int,input().split()))
    for i in range(len(p)):
        if(l[p[i]]==0):
            print(p[i],end=' ')
            l[p[i]]=p[i]

    print()