#include <bits/stdc++.h>
using namespace std;
const int64_t N = 1e6 + 6, M = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n), v(n);
    vector<vector<int64_t>> f(n + 1);
    for (int64_t &e : a) cin >> e;
    for (int64_t i = 0; i < n; i++) f[a[i]].push_back(i);
    for (int64_t i = n; i; i--)
      if (f[i].size()) {
        f[i].push_back(n);
        int64_t m = f[i][0] + 1;
        for (int64_t j = 1; j < f[i].size(); j++)
          m = max(m, (f[i][j] - f[i][j - 1]));
        v[m - 1] = i;
      }
    int64_t p = M;
    for (int64_t e : v) {
      if (e) p = min(p, e);
      cout << (p == M ? -1 : p) << ' ';
    }
    cout << '\n';
  }
}
