#include <bits/stdc++.h>
using namespace std;
const long long int hell = (long long int)(1e18 + 100LL);
const double pi = acos(-1.0);
int main() {
  long long int t, i, j, k, m, n, x, y, z;
  t = 1;
  cin >> t;
  while (t--) {
    long long int flag = 0, K;
    cin >> n;
    vector<long long int> ar(n);
    vector<vector<long long int> > V(n + 1);
    for (i = 0; i < n; i++) {
      cin >> ar[i];
      V[ar[i]].push_back(i + 1);
    }
    vector<long long int> ans(n + 1, hell);
    for (i = 1; i <= n; i++) {
      V[i].push_back(0);
      V[i].push_back(n + 1);
      sort((V[i]).begin(), (V[i]).end());
      if (V[i].size() == 2) continue;
      y = 0;
      for (j = 1; j < V[i].size(); j++) {
        x = V[i][j] - V[i][j - 1];
        y = max(y, x);
      }
      ans[y] = min(ans[y], i);
    }
    x = hell;
    for (i = 1; i <= n; i++) {
      x = min(x, ans[i]);
      if (x == hell) {
        cout << "-1 ";
      } else {
        cout << x << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
