#include <bits/stdc++.h>
using namespace std;
int xd[300007];
int maxi[300007], last[300007];
int ans[300007];
vector<pair<int, int> > lol;
bool cmp(pair<int, int> i, pair<int, int> j) {
  if (i.first == j.first)
    return i < j;
  else
    return i.second > j.second;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    fill(maxi + 1, maxi + n + 1, 0);
    fill(last + 1, last + n + 1, 0);
    fill(ans + 1, ans + n + 1, -1);
    for (int i = 1; i <= n; i++) {
      cin >> xd[i];
      maxi[xd[i]] = max(maxi[xd[i]], i - last[xd[i]]);
      last[xd[i]] = i;
    }
    for (int i = 1; i <= n; i++) maxi[i] = max(maxi[i], n + 1 - last[i]);
    for (int i = 1; i <= n; i++) {
      for (int j = maxi[i]; j <= n and ans[j] == -1; j++) ans[j] = i;
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
    cout << '\n';
  }
  return 0;
}
