#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<vector<int> > pos(n);
    for (int i = 0; i < (int)n; i++) pos[i].push_back(-1);
    for (int i = 0; i < (int)n; i++) {
      int k;
      cin >> k;
      pos[k - 1].push_back(i);
    }
    for (int i = 0; i < (int)n; i++) pos[i].push_back(n);
    vector<int> ans(n + 1, INF);
    for (int i = 0; i < (int)n; i++) {
      int diff = 0;
      for (int j = 1; j < (int)pos[i].size(); j++)
        diff = max(diff, pos[i][j] - pos[i][j - 1]);
      if (diff <= n) ans[diff] = min(ans[diff], i);
    }
    for (int i = 1; i < (int)n + 1; i++) {
      if (i > 0) ans[i] = min(ans[i], ans[i - 1]);
      cout << (ans[i] == INF ? -1 : ans[i] + 1) << " ";
    }
    cout << '\n';
  }
  return 0;
}
