#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &x : v) cin >> x;
    map<int, int> mp;
    map<int, int> past;
    for (int i = 0; i < n; i++) {
      past[v[i]] = -1;
      mp[v[i]] = 0;
    }
    for (int i = 0; i < n; i++) {
      mp[v[i]] = max(mp[v[i]], i - past[v[i]] - 1);
      past[v[i]] = i;
    }
    for (int i = 0; i < n; i++) {
      mp[v[i]] = max(mp[v[i]], n - past[v[i]] - 1);
    }
    vector<int> a(n, -1);
    for (auto &x : mp) {
      int w = x.second;
      if (a[w] != -1) {
        a[w] = min(a[w], x.first);
      } else {
        a[w] = x.first;
      }
    }
    bool flag = true;
    int minval = INT_MAX;
    for (auto &x : a) {
      if (x != -1) {
        minval = min(minval, x);
      }
      if (minval != INT_MAX) {
        if (x == -1) {
          x = minval;
        }
        x = min(x, minval);
        minval = x;
      }
    }
    for (auto &x : a) cout << x << " ";
    cout << '\n';
  }
  return 0;
}
