#include <bits/stdc++.h>
using namespace std;
void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long me(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool check2(vector<long long int> v, long long int l, long long int sum) {
  bool knap[v.size() + 1][sum + 1];
  for (int i = 0; i <= v.size(); i++) knap[i][0] = true;
  for (int i = 1; i <= sum; i++) knap[0][i] = false;
  for (long long int i = 1; i < v.size() + 1; i++) {
    for (long long int j = 1; j < sum + 1; j++) {
      if (v[i - 1] <= j)
        knap[i][j] = knap[i - 1][j] || knap[i - 1][j - v[i - 1]];
      else
        knap[i][j] = knap[i - 1][j];
    }
  }
  if (knap[v.size()][sum])
    return true;
  else
    return false;
}
bool check33(long long int a[], long long int n) {
  for (long long int i = 0; i < n - 1; i++) {
    if (a[i] <= a[i + 1]) return true;
  }
  return false;
}
string kmp_algo(string s) {
  long long int n = s.length();
  long long int pi[n];
  pi[0] = 0;
  for (long long int i = 1; i < n; i++) {
    long long int l = pi[i - 1];
    while (l > 0 && s[l] != s[i]) {
      l = pi[l - 1];
    }
    if (s[i] == s[l]) l++;
    pi[i] = l;
  }
  string temp = s.substr(0, pi[n - 1]);
  return temp;
}
long long int f(long long int n) {
  for (long long int i = 2; i <= n - 1; i++)
    if (n % i == 0) return false;
  return true;
}
void solve() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  vector<vector<long long int>> v(n + 1);
  vector<long long int> ans(n + 1, 1e17);
  for (long long int i = 1; i <= n; i++) {
    v[i].push_back(-1);
  }
  for (long long int i = 0; i < n; i++) v[a[i]].push_back(i);
  for (long long int i = 1; i <= n; i++) {
    v[i].push_back(n);
  }
  for (long long int i = 1; i <= n; i++) {
    long long int k = -1e17;
    for (long long int j = 1; j < v[i].size(); j++)
      k = max(k, v[i][j] - v[i][j - 1]);
    if (k <= n) ans[k] = min(ans[k], i);
  }
  long long int p = -1;
  for (long long int i = 1; i <= n; i++)
    if (ans[i] != 1e17) {
      p = i;
      break;
    }
  if (p == -1) p = n + 1;
  for (long long int i = p - 1; i >= 0; i--) ans[i] = -1;
  for (long long int i = p; i <= n;) {
    long long int k = 0;
    for (long long int j = i + 1; ans[j] >= ans[i] && j <= n; j++)
      k++, ans[j] = ans[i];
    i += k + 1;
  }
  for (long long int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
int main() {
  c_p_c();
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
