A permutation of length n is a sequence of integers from 1 to n of length n containing each number exactly once. For example, [1], [4, 3, 5, 1, 2], [3, 2, 1] are permutations, and [1, 1], [0, 1], [2, 2, 1, 4] are not.

There was a permutation p[1 ... n]. It was merged with itself. In other words, let's take two instances of p and insert elements of the second p into the first maintaining relative order of elements. The result is a sequence of the length 2n.

For example, if p=[3, 1, 2] some possible results are: [3, 1, 2, 3, 1, 2], [3, 3, 1, 1, 2, 2], [3, 1, 3, 1, 2, 2]. The following sequences are not possible results of a merging: [1, 3, 2, 1, 2, 3], [3, 1, 2, 3, 2, 1], [3, 3, 1, 2, 2, 1].

For example, if p=[2, 1] the possible results are: [2, 2, 1, 1], [2, 1, 2, 1]. The following sequences are not possible results of a merging: [1, 1, 2, 2], [2, 1, 1, 2], [1, 2, 2, 1].

Your task is to restore the permutation p by the given resulting sequence a. It is guaranteed that the answer exists and is unique.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 400) — the number of test cases. Then t test cases follow.

The first line of the test case contains one integer n (1 ≤ n ≤ 50) — the length of permutation. The second line of the test case contains 2n integers a_1, a_2, ..., a_{2n} (1 ≤ a_i ≤ n), where a_i is the i-th element of a. It is guaranteed that the array a represents the result of merging of some permutation p with the same permutation p.

Output

For each test case, print the answer: n integers p_1, p_2, ..., p_n (1 ≤ p_i ≤ n), representing the initial permutation. It is guaranteed that the answer exists and is unique.

Example

Input


5
2
1 1 2 2
4
1 3 1 4 3 4 2 2
5
1 2 1 2 3 4 3 5 4 5
3
1 2 3 1 2 3
4
2 3 2 4 1 3 4 1


Output


1 2 
1 3 4 2 
1 2 3 4 5 
1 2 3 
2 3 4 1 
#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';
  }
}
