#include <bits/stdc++.h>
using namespace std;
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
const int MAXN = 1000005;
long long int fac[MAXN];
const int mod = 1e9 + 7;
long long int expo(long long int a, long long int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    long long int y = expo(a, b / 2);
    return (y * y) % mod;
  } else
    return (a * expo(a, b - 1)) % mod;
}
long long int modinv(long long int n) { return expo(n, mod - 2); }
long long int C(int n, int r) {
  long long int ans =
      (fac[n] * ((modinv(fac[r]) * modinv(fac[n - r])) % mod)) % mod;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    int a[2 * n];
    int h[n + 1];
    memset(h, 0, sizeof(h));
    vector<int> p;
    for (int i = 0; i < 2 * n; i++) {
      cin >> a[i];
      if (h[a[i]] == 0) {
        h[a[i]] = i + 1;
        p.push_back(i);
      }
    }
    for (auto u : p) cout << a[u] << " ";
    cout << "\n";
  }
  return 0;
}
