#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(2 * n);
    for (auto &it : a) cin >> it;
    vector<int> kop(n);
    vector<int> ARR;
    for (int i = 0; i < 2 * n; ++i) {
      if (!kop[a[i] - 1]) {
        kop[a[i] - 1] = true;
        ARR.push_back(a[i]);
      }
    }
    for (auto it : ARR) cout << it << " ";
    cout << endl;
  }
  return 0;
}
