#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int mod = 1e9 + 7;
const int oo = 1e18 + 9;
const int inf = INT_MAX;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
void INPUT() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  INPUT();
  int _;
  cin >> _;
  while (_--) {
    int n;
    cin >> n;
    int a[n + 1];
    vector<vector<int>> v(n + 1);
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      v[a[i]].push_back(i);
    }
    vector<int> mp(n + 1, inf);
    for (int i = 1; i <= n; i++) {
      if (!v[i].size()) continue;
      v[i].push_back(n + 1);
      int mx = v[i][0];
      for (int j = 1; j < v[i].size(); j++) mx = max(v[i][j] - v[i][j - 1], mx);
      mp[mx] = min(i, mp[mx]);
    }
    for (int i = 2; i <= n; i++) mp[i] = min(mp[i], mp[i - 1]);
    for (int i = 1; i <= n; i++)
      if (mp[i] == inf)
        cout << "-1 ";
      else
        cout << mp[i] << " ";
    cout << '\n';
  }
  return 0;
}
