#include <bits/stdc++.h>
using namespace std;
struct __timestamper {};
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      a[i]--;
    }
    vector<vector<int>> vct(n);
    for (int i = 0; i < n; i++) {
      vct[i].push_back(-1);
    }
    for (int i = 0; i < n; i++) {
      vct[a[i]].push_back(i);
    }
    for (int i = 0; i < n; i++) {
      vct[i].push_back(n);
    }
    const int INF = 1e9;
    vector<int> ans(n, INF);
    for (int i = 0; i < n; i++) {
      int mx = -1;
      for (int j = 1; j < (int)vct[i].size(); j++) {
        mx = max(mx, vct[i][j] - vct[i][j - 1]);
      }
      if (mx <= n) {
        ans[mx - 1] = min(ans[mx - 1], i);
      }
    }
    for (int i = 1; i < n; i++) ans[i] = min(ans[i], ans[i - 1]);
    for (int i = 0; i < n; i++) {
      if (ans[i] == INF)
        ans[i] = -1;
      else
        ans[i]++;
    }
    for (int i = 0; i < n; i++) printf("%d%c", ans[i], " \n"[i + 1 == n]);
  }
  return 0;
}
