#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, a;
  vector<int> ans;
  map<int, int> val;
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> a;
    if (val[a] == 0) ans.push_back(a);
    val[a]++;
  }
  for (int i : ans) cout << i << " ";
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
