#include <bits/stdc++.h>
using namespace std;
const long long N = 100000 + 123;
const long long mod = 1e9 + 7;
const long long rx[] = {-1, +1, 0, 0};
const long long ry[] = {0, 0, -1, +1};
const long double eps = 0.00001;
const long long inf = 1e5 + 10;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(2 * n);
    vector<long long> cnt(n + 1, 0);
    for (long long i = 0; i < 2 * n; ++i) {
      cin >> a[i];
      cnt[a[i]]++;
      if (cnt[a[i]] == 2) cout << a[i] << " ";
    }
    cout << '\n';
  }
}
