#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  vector<int> A(2 * n);
  for (int i = (int)(0); i < (int)(2 * n); i++) cin >> A[i];
  set<int> se;
  vector<int> ans;
  for (int i = (int)(0); i < (int)(2 * n); i++) {
    if (!se.count(A[i])) {
      se.insert(A[i]);
      ans.push_back(A[i]);
    }
  }
  for (int i = (int)(0); i < (int)(n); i++) cout << ans[i] << ' ';
  cout << "\n";
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
