#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[2 * n];
    unordered_map<int, bool> m;
    for (int i = 0; i < 2 * n; ++i) {
      cin >> arr[i];
      m.insert({arr[i], false});
    }
    vector<int> v;
    for (int i = 0; i < 2 * n; ++i) {
      if (!m[arr[i]]) {
        v.push_back(arr[i]);
        m[arr[i]] = true;
      }
    }
    for (auto itr : v) cout << itr << " ";
    cout << endl;
  }
  return 0;
}
