#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
int a[maxn];
void solve() {
  int n;
  cin >> n;
  vector<int> pre(n + 1, 0), dis(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    dis[x] = max(dis[x], i - pre[x]);
    pre[x] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (dis[i] > 0) {
      dis[i] = max(dis[i], n + 1 - pre[i]);
    }
  }
  vector<int> ans(n + 1, 1e9);
  for (int i = 1; i <= n; i++) {
    if (dis[i] > 0 && ans[dis[i]] == 1e9) {
      ans[dis[i]] = i;
    }
  }
  for (int i = 2; i <= n; i++) {
    ans[i] = min(ans[i], ans[i - 1]);
  }
  for (int i = 1; i <= n; i++) {
    cout << (ans[i] == 1e9 ? -1 : ans[i]) << " \n"[i == n];
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
