#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    vector<int> v[n + 1], g[n + 1];
    for (int i = 0; i < n + 1; i++) {
      v[i].push_back(-1);
    }
    for (int i = 0; i < n; i++) {
      v[a[i]].push_back(i);
    }
    for (int i = 0; i < n + 1; i++) {
      v[i].push_back(n);
    }
    int mi = 1000000000;
    int u = -1;
    for (int i = 1; i < n + 1; i++) {
      int c = 0;
      int y = 0;
      if (v[i].size() == 2) continue;
      for (int j = 1; j < v[i].size(); j++) {
        c = max(c, v[i][j] - v[i][j - 1]);
      }
      g[c].push_back(i);
    }
    for (int i = 1; i < n + 1; i++) {
      sort(v[i].begin(), v[i].end());
    }
    int o = -1;
    for (int i = 1; i < n + 1; i++) {
      if (g[i].size() == 0)
        cout << o << " ";
      else {
        if (g[i][0] < o || o == -1) o = g[i][0];
        cout << o << " ";
      }
    }
    cout << endl;
  }
}
