#include <bits/stdc++.h>
using namespace std;
int main() {
  int ___T, case_n = 1;
  scanf("%d ", &___T);
  while (___T-- > 0) {
    int(n);
    scanf("%d", &n);
    vector<int> a(n);
    vector<int> b(n, -1);
    vector<int> c(n, 0);
    for (int i = 0; i < (n); ++i) {
      int(x);
      scanf("%d", &x);
      x--;
      a[i] = x;
      c[a[i]] = max(c[a[i]], i - b[a[i]]);
      b[a[i]] = i;
    }
    set<pair<int, int> > s;
    for (int i = 0; i < (n); ++i) {
      c[i] = max(c[i], n - b[i]);
      s.insert({c[i], i + 1});
    }
    int lim = 1000000;
    int mr = lim;
    auto it = s.begin();
    for (int i = (1); i < (n + 1); ++i) {
      while (it != s.end() and it->first <= i) {
        mr = min(mr, it->second);
        it++;
      }
      if (mr < lim) {
        printf("%d", mr);
      } else {
        printf("-1", mr);
      }
      printf("%c", (i == n) ? '\n' : ' ');
    }
  }
}
