#include <bits/stdc++.h>
using namespace std;
long long n, tc;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> tc;
  while (tc--) {
    cin >> n;
    int a[2 * n];
    for (int i = 0; i < 2 * n; i++) cin >> a[i];
    bool check[n + 1];
    for (int i = 0; i <= n; i++) check[i] = false;
    for (int i = 0; i < 2 * n; i++) {
      if (check[a[i]] == false) {
        cout << a[i] << " ";
        check[a[i]] = true;
      }
    }
    cout << endl;
  }
  return 0;
}
