#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> v(2 * n);
    map<long long int, long long int> mp;
    for (int i = 0; i < 2 * n; i++) {
      cin >> v[i];
    }
    for (int i = 0; i < 2 * n; i++) {
      if (mp[v[i]] == 0) {
        cout << v[i] << " ";
        mp[v[i]]++;
      }
    }
    cout << endl;
  }
}
