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;
template <typename T>
T gcd(T a, T b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
template <typename T>
T setbit(T mask, T pos) {
  return mask |= (1 << pos);
}
template <typename T>
T resetbit(T mask, T pos) {
  return mask &= ~(1 << pos);
}
template <typename T>
T togglebit(T mask, T pos) {
  return mask ^= (1 << pos);
}
template <typename T>
T checkbit(T mask, T pos) {
  return (bool)(mask & (1 << pos));
}
template <typename T>
T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <typename T>
T modu(T a, T b) {
  return (a < b ? a : a % b);
}
template <typename T>
T mod_neg(T a, T b) {
  a = 1000000007(a, b);
  if (a < 0) {
    a += b;
  }
  return a;
}
template <typename T>
T expo(T e, T n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T mod_inverse(T a, T n) {
  T x, y;
  T d = extended_euclid(a, n, x, y);
  return (d > 1 ? -1 : mod_neg(x, n));
}
template <typename T>
T power(T e, T n, T m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = 1000000007(x * p, m);
    p = 1000000007(p * p, m);
    n >>= 1;
  }
  return x;
}
template <typename T>
T powerL(T e, T n, T m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mulmod(x, p, m);
    p = mulmod(p, p, m);
    n >>= 1;
  }
  return x;
}
bool Pow2(int n) { return n && (!(n & (n - 1))); }
void printc(vector<char>& result) {
  for (auto r : result) cout << r;
  cout << '\n';
}
void printl(vector<long long>& result) {
  for (auto r : result) cout << r << " ";
  cout << '\n';
}
void print(vector<int>& result) {
  for (auto r : result) cout << r << " ";
  cout << '\n';
}
int binpow(int a, int b) {
  if (b == 0) return a;
  int res = binpow(a, b / 2);
  if (b % 2)
    return res * res * a;
  else
    return res * res;
}
long long pow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long modpow(long long a, long long b, long long m) {
  a = a % m;
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans % m * a % m) % m;
    b /= 2;
    a = (a % m * a % m) % m;
  }
  return ans;
}
long long ncr(long long n, long long k) {
  long long res = 1;
  if (k > n - k) k = n - k;
  for (long long i = 0; i < k; ++i) {
    res = res * (n - i);
    res /= (i + 1);
  }
  return res;
}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int find(int a, vector<int>& par) {
  if (par[a] == a) return a;
  return par[a] = find(par[a], par);
}
void merge(int a, int b, vector<int>& par, int& count, vector<int>& size) {
  a = find(a, par);
  b = find(b, par);
  if (a == b) return;
  count++;
  if (size[a] > size[b]) {
    size[a] += size[b];
    par[b] = a;
  } else {
    size[b] += size[a];
    par[a] = b;
  }
}
long long factor(long long a) {
  vector<int> f;
  for (long long i = 1; i * i <= a; i++) {
    if (a % i == 0) {
      f.push_back(i);
      if (a / i != i) f.push_back(a / i);
    }
  }
  sort((f).begin(), (f).end());
  if (f.size() == 2)
    return 1;
  else
    return f[f.size() - 2];
}
bool comp(string& a, string& b) { return (a.size() < b.size()); }
long long fans;
bool ok(long long mid, vector<long long>& v, long long b) {
  vector<long long> sum(v.size());
  for (long long i = 0; i < v.size(); i++) {
    sum[i] += v[i] + mid * (i + 1);
  }
  sort((sum).begin(), (sum).end());
  long long sum2 = 0;
  for (int i = 0; i < mid; i++) {
    sum2 += sum[i];
  }
  if (sum2 <= b) {
    fans = sum2;
    return true;
  }
  return false;
}
long long binary(long long start, long long end, vector<long long>& v,
                 long long b) {
  long long ans = 0;
  while (start <= end) {
    long long mid = start + (end - start) / 2;
    if (ok(mid, v, b))
      ans = max(ans, mid), start = mid + 1;
    else
      end = mid - 1;
  }
  return ans;
}
int count1(int n, int m, int a, int b) {
  int count = 0;
  if (a < n - 1) count++;
  if (a > 0) count++;
  if (b < m - 1) count++;
  if (b > 0) count++;
  return count;
}
int h, w, k;
char a[7][7];
char b[7][7];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test;
  test = 1;
  cin >> test;
  while (test--) {
    int n;
    cin >> n;
    vector<int> v(2 * n);
    for (int(i) = 0; (i) < (int)(2 * n); ++(i)) cin >> v[i];
    vector<int> ans;
    vector<bool> vis(n + 1, false);
    for (int(i) = 0; (i) < (int)(2 * n); ++(i)) {
      if (!vis[v[i]]) {
        ans.push_back(v[i]);
        vis[v[i]] = true;
      }
    }
    print(ans);
  }
}
