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