#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, c;
  scanf("%d", &t);
  while (t--) {
    long long int n;
    scanf("%lld", &n);
    n = 2 * n;
    int a[n];
    unordered_set<int> s;
    int z = s.size();
    vector<int> v;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s.insert(a[i]);
      if (s.size() > z) {
        z = s.size();
        v.push_back(a[i]);
      }
    }
    for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
    cout << "\n";
  }
  return 0;
}
