#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> arr(2 * n);
    for (int &x : arr) cin >> x;
    map<int, int> vis;
    vector<int> ans;
    for (int x : arr) {
      if (vis.find(x) == vis.end()) {
        ans.push_back(x);
        vis[x] = 1;
      }
    }
    for (int x : ans) cout << x << " ";
    cout << "\n";
  }
  return 0;
}
