#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
void bober() {
  int n;
  cin >> n;
  vector<int> a(n + 1), last(n + 1, 0), used(n + 1, INF), mx;
  mx.assign(n + 1, n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (!last[a[i]]) {
      mx[a[i]] = i;
    } else {
      mx[a[i]] = max(mx[a[i]], i - last[a[i]]);
    }
    last[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (last[i]) {
      mx[i] = max(mx[i], n + 1 - last[i]);
      used[mx[i]] = min(i, used[mx[i]]);
    }
  }
  for (int i = 2; i <= n; i++) {
    if (used[i - 1] != INF) used[i] = min(used[i - 1], used[i]);
  }
  for (int i = 1; i <= n; i++) {
    cout << (used[i] == INF ? -1 : used[i]) << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    bober();
  }
  return 0;
}
