#include <bits/stdc++.h>
template <class C>
inline void log_c(const C& c) {}
template <class C>
inline int sz(const C& c) {
  return static_cast<int>(c.size());
}
using namespace std;
using pii = pair<int, int>;
using num = int64_t;
using pll = pair<num, num>;
const std::string eol = "\n";
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  vector<bool> s;
  while (t--) {
    int n;
    cin >> n;
    s.clear();
    s.resize(n + 1);
    for (int k = 0; k < (2 * n); ++k) {
      int x;
      cin >> x;
      if (!s[x]) {
        s[x] = true;
        cout << x << ' ';
      }
    }
    cout << eol;
  }
  return 0;
}
