#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
void LINE(vector<int> &vec) {
  int N = vec.size();
  for (int i = 0; i < N; i++) {
    if (i == N - 1) {
      cout << vec[i] << endl;
    } else {
      cout << vec[i] << " ";
    }
  }
}
void solve() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec[i];
  }
  vector<vector<int>> G(N + 1, vector<int>(0));
  for (int i = 0; i < N; i++) {
    G[vec[i]].push_back(i);
  }
  for (int i = 0; i < N + 1; i++) {
    G[i].push_back(-1);
    G[i].push_back(N);
    sort(G[i].begin(), G[i].end());
  }
  vector<int> ans(N, -1);
  for (int i = 1; i <= N; i++) {
    if (G[i].size() == 2) {
      continue;
    }
    int MAX = 0;
    for (int j = 0; j < G[i].size() - 1; j++) {
      MAX = max(MAX, G[i][j + 1] - G[i][j]);
    }
    if (ans[max(0, MAX - 1)] == -1) {
      ans[max(0, MAX - 1)] = i;
    } else {
      ans[max(0, MAX - 1)] = min(ans[max(0, MAX - 1)], i);
    }
  }
  for (int i = 1; i < N; i++) {
    if (ans[i - 1] != -1) {
      if (ans[i] == -1) {
        ans[i] = ans[i - 1];
      } else {
        ans[i] = min(ans[i], ans[i - 1]);
      }
    }
  }
  LINE(ans);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    solve();
  }
}
