#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b % 2 != 0) {
      ans = (ans * a) % 1000000007;
    }
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
    b >>= 1;
  }
  return ans;
}
void sieve(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p]) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++) {
    if (prime[p]) cout << p << " ";
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    map<int, vector<int>> m;
    for (int i = 0; i < n; i++) {
      int z;
      cin >> z;
      if (m.count(z) == false) m[z].push_back(0);
      m[z].push_back(i + 1);
    }
    for (auto i : m) {
      m[i.first].push_back(n + 1);
    }
    map<int, int> m1;
    for (auto i : m) {
      int ha = i.first;
      int jha = -1;
      for (int j = 0; j < i.second.size() - 1; j++) {
        jha = max(i.second[j + 1] - i.second[j], jha);
      }
      if (jha != -1) {
        if (m1.count(jha) == false) {
          m1[jha] = ha;
        }
      }
    }
    int val = INT_MAX;
    for (int i = 1; i <= n; i++) {
      if (m1.count(i)) {
        val = min(val, m1[i]);
      }
      if (val == INT_MAX)
        cout << -1 << " ";
      else
        cout << val << " ";
    }
    cout << '\n';
  }
  return 0;
}
