#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    unordered_set<int> s;
    vector<int> ans;
    int x;
    for (int i = 0; i < 2 * n; i++) {
      cin >> x;
      if (s.find(x) != s.end()) ans.push_back(x);
      s.insert(x);
    }
    for (auto i : ans) cout << i << " ";
    cout << endl;
  }
}
