#include <bits/stdc++.h>
using namespace std;
inline long long maxi(long long &a, long long b) {
  if (b > a) {
    a = b;
    return 1;
  }
  return 0;
}
inline long long mini(long long &a, long long b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
inline long long maxi(long double &a, long double b) {
  if (b > a) {
    a = b;
    return 1;
  }
  return 0;
}
inline long long mini(long double &a, long double b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    n *= 2;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
    }
    vector<long long> ans;
    vector<long long> hv(n + 1);
    for (long long i = 0; i < n; i++) {
      hv[a[i]]++;
      if (hv[a[i]] == 2) {
        ans.push_back(a[i]);
      }
    }
    for (auto now : ans) {
      cout << now << ' ';
    }
    cout << "\n";
  }
  return 0;
}
