#include <bits/stdc++.h>
using namespace std;
const static int inf = 0x3f3f3f3f;
const static long long INF = 0x3f3f3f3f3f3f3f3f;
const static int maxn = 3e5 + 10;
vector<int> g[maxn];
int ans[maxn];
int n;
void init() {
  for (int i = 1; i <= n; i++) {
    g[i].clear();
    ans[i] = -1;
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    init();
    for (int i = 1; i <= n; i++) g[i].push_back(0);
    for (int i = 1; i <= n; i++) {
      int a;
      cin >> a;
      g[a].push_back(i);
    }
    for (int i = 1; i <= n; i++) g[i].push_back(n + 1);
    for (int i = n; i >= 1; i--) {
      int maxx = -1;
      for (int j = 0; j < (int)g[i].size() - 1; j++)
        maxx = max(maxx, g[i][j + 1] - g[i][j]);
      ans[maxx] = i;
    }
    int i = 1;
    while (ans[i] == -1) i++;
    i++;
    for (; i <= n; i++) {
      if (ans[i] == -1)
        ans[i] = ans[i - 1];
      else
        ans[i] = min(ans[i], ans[i - 1]);
    }
    for (int i = 1; i <= n; i++) {
      if (i == 1)
        cout << ans[i];
      else
        cout << " " << ans[i];
    }
    cout << endl;
  }
  return 0;
}
