#include <bits/stdc++.h>
using namespace std;
long long T;
long long n;
long long a[300005];
vector<long long> vec[300005];
long long b[300005];
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> T;
  for (int t = 0; t < T; t++) {
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      vec[i].clear();
      vec[i].push_back(0);
      vec[i].push_back(n + 1);
    }
    for (int i = 1; i <= n; i++) vec[a[i]].push_back(i);
    for (int i = 1; i <= n; i++) b[i] = 1e18;
    for (long long i = 1; i <= n; i++) {
      sort(vec[i].begin(), vec[i].end());
      long long mx = 0;
      for (int j = 1; j < vec[i].size(); j++) {
        mx = max(mx, vec[i][j] - vec[i][j - 1]);
      }
      (b[mx]) = min((b[mx]), (i));
    }
    for (int i = 2; i <= n; i++) (b[i]) = min((b[i]), (b[i - 1]));
    for (int i = 1; i <= n; i++) {
      if (b[i] > 1e18 / 2) b[i] = -1;
      cout << b[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
