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