#include <bits/stdc++.h>
using namespace std;
int T, n, ans[300005];
pair<int, int> a[300005];
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = (1), _ = (n); i <= _; i++)
      scanf("%d", &a[i].first), a[i].second = i;
    sort(a + 1, a + n + 1);
    for (int i = (1), _ = (n); i <= _; i++) ans[i] = 1e9;
    for (int i = 1, j; i <= n; i = j + 1) {
      j = i;
      while (j < n && a[i].first == a[j + 1].first) j++;
      int w = a[i].second - 0;
      for (int k = (i), _ = (j - 1); k <= _; k++)
        w = max(w, a[k + 1].second - a[k].second);
      w = max(w, n + 1 - a[j].second);
      ans[w] = min(ans[w], a[i].first);
    }
    int val = 1e9;
    for (int i = (1), _ = (n); i <= _; i++) {
      val = min(val, ans[i]);
      printf("%d ", val == (int)1e9 ? -1 : val);
    }
    puts("");
  }
  return 0;
}
