#include <bits/stdc++.h>
using namespace std;
vector<int> idx[300000 + 5];
int ans[300000 + 5];
int main() {
  int cas;
  scanf("%d", &cas);
  while (cas--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) idx[i].clear();
    for (int i = 1; i <= n; i++) idx[i].push_back(0);
    for (int i = 1; i <= n; i++) {
      int x;
      scanf("%d", &x);
      idx[x].push_back(i);
    }
    for (int i = 1; i <= n; i++) idx[i].push_back(n + 1);
    for (int k = 1; k <= n; k++) ans[k] = 0x3f3f3f3f;
    for (int i = n; i >= 1; i--) {
      int d = 0, l = idx[i].size();
      for (int j = 1; j <= l - 1; j++) d = max(d, idx[i][j] - idx[i][j - 1]);
      ans[d] = i;
    }
    for (int k = 2; k <= n; k++) ans[k] = min(ans[k - 1], ans[k]);
    for (int i = 1; i <= n; i++)
      if (ans[i] == 0x3f3f3f3f) ans[i] = -1;
    for (int i = 1; i <= n; i++) printf("%d%c", ans[i], " \n"[i == n]);
  }
  return 0;
}
