#include <bits/stdc++.h>
using namespace std;
const long long NR = 3e5 + 1e3;
const long long oo = 1e9 + 100;
const long long MOD = 1e9 + 7;
const long long MOD2 = 1e9 + 9;
int t, n, a[NR];
vector<int> v[NR];
int sp[NR];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int i;
  sp[0] = oo;
  cin >> t;
  while (t--) {
    cin >> n;
    for (i = 1; i <= n; ++i) {
      sp[i] = oo;
      cin >> a[i];
      v[a[i]].push_back(i);
    }
    for (i = 1; i <= n; ++i) {
      if (v[a[i]].empty()) continue;
      int max_dist = 0, j;
      for (j = 0; j < v[a[i]].size(); ++j) {
        if (j == 0) {
          max_dist = max(max_dist, v[a[i]][0]);
        } else {
          max_dist = max(max_dist, v[a[i]][j] - v[a[i]][j - 1]);
        }
        if (j == v[a[i]].size() - 1) {
          max_dist = max(max_dist, n - v[a[i]][j] + 1);
          continue;
        }
      }
      v[a[i]].clear();
      sp[max_dist] = min(sp[max_dist], a[i]);
    }
    for (i = 1; i <= n; ++i) {
      sp[i] = min(sp[i], sp[i - 1]);
      if (sp[i] == oo)
        cout << "-1 ";
      else
        cout << sp[i] << ' ';
    }
    cout << '\n';
  }
  return 0;
}
