#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 1000;   const long long INF64 = 1e18;   const int N = 1001000;   const int MOD = 1e9 + 7;   const double EPS = 1E-9;   long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); }   int add(int first, int second, int m) {     first += second;     while (first >= m) first -= m;     while (first < 0) first += m;     return first;   }   int sub(int first, int second, int m) { return add(first, -second, m); }   int mul(int first, int second, int m) { return (first * 1ll * second) % m; }   int binpow(int first, int second, int m) {     int z = 1;     while (second) {       if (second & 1) z = mul(z, first, m);       first = mul(first, first, m);       second >>= 1;     }     return z;   }   int divide(int first, int second, int m) {     return mul(first, binpow(second, m - 2, m), m);   }   const int K = 2;   mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());   bool is_prime(int first) {     for (int i = 2; i * 1ll * i <= first; i++)       if (first % i == 0) return false;     return true;   }   int gen_prime(int first, int offset) {     int z = first + (rnd() % offset);     while (!is_prime(z)) z++;     return z;   }   array<int, K> P = {10, 10};   array<int, K> M = {1000000007, 1000000009};   void precalc() {     for (int i = 0; i < K; i++) {       P[i] = gen_prime(100, 100);       M[i] = gen_prime(1000000000, 1000000);     }   }   array<int, K> add(array<int, K> first, array<int, K> second) {     array<int, K> res;     for (int i = 0; i < K; i++) res[i] = add(first[i], second[i], M[i]);     return res;   }   array<int, K> sub(array<int, K> first, array<int, K> second) {     array<int, K> res;     for (int i = 0; i < K; i++) res[i] = sub(first[i], second[i], M[i]);     return res;   }   array<int, K> mul(array<int, K> first, array<int, K> second) {     array<int, K> res;     for (int i = 0; i < K; i++) res[i] = mul(first[i], second[i], M[i]);     return res;   }   array<int, K> binpow(array<int, K> first, int second) {     array<int, K> res;     for (int i = 0; i < K; i++) res[i] = binpow(first[i], second, M[i]);     return res;   }   array<int, K> divide(array<int, K> first, array<int, K> second) {     array<int, K> z;     for (int i = 0; i < K; i++) z[i] = divide(first[i], second[i], M[i]);     return z;   }   int code(char c) { return (c -  0 ); }   array<int, K> make_hash(int first) {     array<int, K> res;     for (int i = 0; i < K; i++) res[i] = first;     return res;   }   vector<array<int, K> > get_prefix_hashes(const string& s) {     int n = s.size();     vector<array<int, K> > ans(n + 1);     array<int, K> curP = make_hash(1);     for (int i = 0; i < n; i++) {       ans[i + 1] = add(ans[i], mul(make_hash(code(s[i])), curP));       curP = mul(curP, P);     }     return ans;   }   array<int, K> DP[N], DQ[N];   array<int, K> substr_hash(const vector<array<int, K> >& p, int l, int r) {     return mul(sub(p[r], p[l]), DQ[l]);   }   array<int, K> concat(array<int, K> a, array<int, K> b, int len) {     return add(a, mul(b, DP[len]));   }   vector<array<int, K> > test;   void preprecalc() {     DP[0] = make_hash(1);     for (int i = 1; i < N; i++) DP[i] = mul(P, DP[i - 1]);     for (int i = 0; i < N; i++) DQ[i] = divide(make_hash(1), DP[i]);   }   int ans = INF;   string s;   void rec(int l, int r, char c, int cur) {     if (r - l == 1) {       cur += (s[l] != c);       ans = min(ans, cur);       return;     }     int m = (r + l) / 2;     int curl = 0, curr = 0;     for (int i = l; i < m; ++i) {       curl += (s[i] != c);       curr += (s[i + m - l] != c);     }     rec(l, m, c + 1, cur + curr);     rec(m, r, c + 1, cur + curl);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       set<int> have;       for (int i = 0; i < 2 * n; ++i) {         int first;         cin >> first;         if (!have.count(first)) {           cout << first <<    ;           have.insert(first);         }       }       cout <<   n ;     }   }