#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000;
int t, n;
int a[MAXN + 1];
vector<int> c[MAXN + 1];
int k[MAXN + 1];
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      c[i].clear();
      c[i].push_back(0);
      k[i] = MAXN + 1;
    }
    for (int i = 1; i <= n; i++) c[a[i]].push_back(i);
    for (int i = 1; i <= n; i++) c[i].push_back(n + 1);
    for (int i = 1; i <= n; i++) {
      int now = 0;
      for (int j = 1; j < c[i].size(); j++)
        now = max(now, c[i][j] - c[i][j - 1]);
      k[now] = min(k[now], i);
    }
    for (int i = 2; i <= n; i++) k[i] = min(k[i], k[i - 1]);
    for (int i = 1; i <= n; i++) {
      if (k[i] == MAXN + 1)
        cout << -1 << " \n"[i == n];
      else
        cout << k[i] << " \n"[i == n];
    }
  }
}
