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>
#pragma GCC optimize("O2")
using namespace std;
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename... T>
void read(T&... args) {
  ((cin >> args), ...);
}
template <typename... T>
void write(T&&... args) {
  ((cout << args << ' '), ...);
}
void getVecIndex(vector<int> v, int K) {
  auto it = find(v.begin(), v.end(), K);
  if (it != v.end()) {
    cout << distance(v.begin(), it);
  } else
    cout << -1;
}
bool isPrime(int num) {
  if (num <= 1) return false;
  if (num == 2) return true;
  if (num % 2 == 0) return false;
  int counter = 3;
  while ((counter * counter) <= num) {
    if (num % counter == 0) {
      return false;
    } else {
      counter += 2;
    }
  }
  return true;
}
unsigned long long fpow(unsigned long long base, unsigned long long exp) {
  base %= 1000000007;
  unsigned long long result = 1;
  while (exp > 0) {
    if (exp & 1)
      result = (static_cast<unsigned long long>(result * base)) % 1000000007;
    base = (static_cast<unsigned long long>(base * base)) % 1000000007;
    exp >>= 1;
  }
  return result;
}
long long binarySearch(int a[], int l, int r, int x) {
  while (l <= r) {
    int mid_index = l + (r - l) / 2;
    if (a[mid_index] == x)
      return mid_index;
    else if (x > a[mid_index]) {
      l = mid_index + 1;
    } else if (x < a[mid_index]) {
      r = mid_index - 1;
    }
  }
  return -1;
}
void permuteString(string s) {
  sort(s.begin(), s.end());
  do {
    cout << s << "\n";
  } while (next_permutation(s.begin(), s.end()));
}
void permuteArray(int array[], int n) {
  sort(array, array + n);
  do {
    for (auto i = 0; i <= n - 1; ++i) cout << array[i] << ' ';
    cout << "\n";
  } while (next_permutation(array, array + n));
}
void permuteVector(vector<int> v) {
  sort(v.begin(), v.end());
  do {
    for (auto& x : v) cout << x << ' ';
    cout << "\n";
  } while (next_permutation(v.begin(), v.end()));
}
unsigned long long largestPrimeFactor(unsigned long long n) {
  for (int factor = 2; factor * factor <= n; ++factor) {
    while (n % factor == 0 and n != factor) n /= factor;
  }
  return n;
}
unsigned long long numberOfDivisors(unsigned long long n) {
  unsigned long long divisors = 0;
  if (n == 1) return 1;
  for (unsigned long long i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      divisors += 2;
    }
  }
  return divisors;
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
void solve() {
  int n;
  read(n);
  vector<int> v(n);
  int c = 0;
  for (long long i = 0; i < 2 * n; ++i) {
    int e;
    read(e);
    if (count(v.begin(), v.end(), e) == 0) {
      v[c] = e;
      ++c;
    }
  }
  for (auto& x : v) cout << x << ' ';
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  auto t1 = std::chrono::high_resolution_clock::now();
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  auto t2 = std::chrono::high_resolution_clock::now();
  auto duration =
      std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1).count();
  cerr << "\nDuration of the algo: " << duration / 1e+6 << " secs"
       << "\n"
       << "\n";
  return 0;
}
