// Arup Guha
// 2/25/2020
// Solution to 2020 UCF HS Contest Problem: Sock Sort

import java.util.*;

public class socks {

    public static void main(String[] args) {

        Scanner stdin = new Scanner(System.in);
        int nC = stdin.nextInt();

		// Process each case.
        for (int loop=0; loop<nC; loop++) {

			// Create an array list for each integer.
            int n = stdin.nextInt();
            ArrayList[] nums = new ArrayList[n];
			
			// Here we store the original list.
            int[] list = new int[2*n];
            for (int i=0; i<n; i++) nums[i] = new ArrayList<Integer>();
			
			// Store data two ways.
            for (int i=0; i<2*n; i++) {
                list[i] = stdin.nextInt()-1;
                nums[list[i]].add(i);
            }

			// I use n different index variables into the n different array lists.
            int[] indexes = new int[n];
			
			// This is which items are used.
            boolean[] used = new boolean[2*n];
			
			// Store the answer here.
            int[] res = new int[2*n];
            int idx = 0, j=2*n-1;
			
			// idx goes left to right through the socks.
            while (idx < 2*n) {

				// This sock was paired up already, skip it.
                if (used[idx]) {
                    idx++;
                    continue;
                }

				// Next sock.
                int next = list[idx];
				
				// Update my index into this list.
                indexes[list[idx]]++;
				
				// This one is used, obviously.
                used[idx] = true;
				
				// We know that both of these are sock number next.
                res[j--] = next;
                res[j--] = next;
				
				// Find where the matching pair of this sock number is.
                int nextIdx = ((ArrayList<Integer>)nums[list[idx]]).get(indexes[list[idx]]);
				
				// Mark it and advance the index to this list.
                used[nextIdx] = true;
                indexes[list[idx]]++;
            }

			// Ta da!
            for (int i=0; i<2*n-1; i++)
                System.out.print((res[i]+1)+" ");
            System.out.println(res[2*n-1]+1);
        }
    }
}