#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 2;
const long long MOD = 1e9 + 7;
const long long Inf = MOD * MOD;
const long double eps = 1e-7;
long long x, Ans[N], timer, t = 1;
int n;
map<int, set<int>> Indexs;
void Solve() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &x);
    Indexs[x].insert(i);
    Ans[i] = Inf;
  }
  vector<int> v;
  for (int i = 1; i <= n; ++i) {
    int m = Indexs[i].size(), mx = 0;
    if (m == 0) continue;
    auto it = Indexs[i].rbegin();
    auto It = Indexs[i].begin();
    while (*it != *It) {
      mx = max(mx, *next(It, 1) - *It);
      It = next(It, 1);
    }
    mx = max(mx, n - *it + 1);
    mx = max(mx, *Indexs[i].begin());
    Ans[mx] = min(Ans[mx], (long long)i);
    Indexs[i].clear();
  }
  for (int i = 1; i < n; ++i) {
    Ans[i + 1] = min(Ans[i + 1], Ans[i]);
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", Ans[i] == Inf ? -1 : Ans[i]);
  }
}
int main() {
  scanf("%lld", &t);
  while (t--) {
    ++timer;
    Solve();
    puts("");
  }
}
