#include <bits/stdc++.h>
using namespace std;
const int mod = 10007;
const int N = 2000010;
int n, m;
int a[100010];
int num[1000];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    vector<int> v;
    scanf("%d", &n);
    memset(num, 0, sizeof num);
    for (int i = 1; i <= 2 * n; i++) {
      scanf("%d", &a[i]);
      num[a[i]]++;
      if (num[a[i]] == 2) v.push_back(a[i]);
    }
    for (int i = 0; i < v.size(); i++) {
      printf("%d ", v[i]);
    }
    printf("\n");
  }
  return 0;
}
