Problem: 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 

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) throws IOException 
    { 
        StdIn scn = new StdIn();
        int t = scn.nextInt();
        while (t-- > 0) {
        	int n = scn.nextInt();
        	Set<Integer> set = new HashSet<>();
        	String ans = "";
        	for (int i = 0; i<2*n; i++) {
        		int inp = scn.nextInt();
        		if (!set.contains(inp)) {
        			ans = ans+inp+" ";
        			set.add(inp);
        		}
        	}
        	System.out.println(ans);
        }
    } 
    interface Input {
    	public String next();
    	public String nextLine();
    	public int nextInt();
    	public long nextLong();
    	public double nextDouble();
    }
    static class StdIn implements Input {
    	final private int BUFFER_SIZE = 1 << 16;
    	private DataInputStream din;
    	private byte[] buffer;
    	private int bufferPointer, bytesRead;

    	public StdIn() {
    		din = new DataInputStream(System.in);
    		buffer = new byte[BUFFER_SIZE];
    		bufferPointer = bytesRead = 0;
    	}
    	
    	public StdIn(String filename) {
    		try{
    			din = new DataInputStream(new FileInputStream(filename));
    		} catch(Exception e) {
    			throw new RuntimeException();
    		}
    		buffer = new byte[BUFFER_SIZE];
    		bufferPointer = bytesRead = 0;
    	}
    	
    	public String next() {
    		int c;
    		while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
    		StringBuilder s = new StringBuilder();
    		while (c != -1)
    		{
    			if (c == ' ' || c == '\n'||c=='\r')
    				break;
    			s.append((char)c);
    			c=read();
    		}
    		return s.toString();
    	}

    	public String nextLine() {
    		int c;
    		while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
    		StringBuilder s = new StringBuilder();
    		while (c != -1)
    		{
    			if (c == '\n'||c=='\r')
    				break;
    			s.append((char)c);
    			c = read();
    		}
    		return s.toString();
    	}

    	public int nextInt() {
    		int ret = 0;
    		byte c = read();
    		while (c <= ' ')
    			c = read();
    		boolean neg = (c == '-');
    		if (neg)
    			c = read();
    		do
    		{
    			ret = ret * 10 + c - '0';
    		}  while ((c = read()) >= '0' && c <= '9');

    		if (neg)
    			return -ret;
    		return ret;
    	}
    	
    	public int[] readIntArray(int n) {
    		int[] ar = new int[n];
    		for(int i=0; i<n; ++i)
    			ar[i]=nextInt();
    		return ar;
    	}

    	public long nextLong() {
    		long ret = 0;
    		byte c = read();
    		while (c <= ' ')
    			c = read();
    		boolean neg = (c == '-');
    		if (neg)
    			c = read();
    		do {
    			ret = ret * 10 + c - '0';
    		}
    		while ((c = read()) >= '0' && c <= '9');
    		if (neg)
    			return -ret;
    		return ret;
    	}
    	
    	public long[] readLongArray(int n) {
    		long[] ar = new long[n];
    		for(int i=0; i<n; ++i)
    			ar[i]=nextLong();
    		return ar;
    	}

    	public double nextDouble() {
    		double ret = 0, div = 1;
    		byte c = read();
    		while (c <= ' ')
    			c = read();
    		boolean neg = (c == '-');
    		if (neg)
    			c = read();

    		do {
    			ret = ret * 10 + c - '0';
    		}
    		while ((c = read()) >= '0' && c <= '9');

    		if (c == '.')
    		{
    			while ((c = read()) >= '0' && c <= '9')
    			{
    				ret += (c - '0') / (div *= 10);
    			}
    		}

    		if (neg)
    			return -ret;
    		return ret;
    	}

    	private void fillBuffer() throws IOException {
    		bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
    		if (bytesRead == -1)
    			buffer[0] = -1;
    	}

    	private byte read() {
    		try{
    			if (bufferPointer == bytesRead)
    				fillBuffer();
    			return buffer[bufferPointer++];
    		} catch(IOException e) {
    			throw new RuntimeException();
    		}
    	}

    	public void close() throws IOException {
    		if (din == null)
    			return;
    		din.close();
    	}
    }
 }