#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 3;
vector<int> wys[MAXN];
void solve() {
  int n, x;
  cin >> n;
  vector<int> ans(n + 7);
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (wys[x].empty()) wys[x].push_back(0);
    wys[x].push_back(i);
  }
  int mx;
  for (int i = 1; i <= n; i++) {
    mx = 0;
    wys[i].push_back(n + 1);
    for (int j = 1; j < (int)(wys[i].size()); j++)
      mx = max(mx, wys[i][j] - wys[i][j - 1]);
    if (ans[mx] == 0) ans[mx] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i] == 0)
      cout << "-1 ";
    else
      cout << ans[i] << ' ';
    if (ans[i + 1] == 0 || (ans[i] != 0 && ans[i + 1] > ans[i]))
      ans[i + 1] = ans[i];
  }
  cout << '\n';
  for (int i = 1; i <= n; i++) wys[i].clear();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int z;
  cin >> z;
  while (z--) solve();
  return 0;
}
