#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
const ll MODBASE = 1000000007LL;
const int MAXN = 300010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;
int te, n, a[MAXN];
vector<int> b[MAXN];
int t[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> te;
  while (te--) {
    cin >> n;
    for (int i = (1); i <= (n); i++) cin >> a[i];
    for (int i = (1); i <= (n); i++) b[i].clear();
    for (int i = (1); i <= (n); i++) b[a[i]].push_back(i);
    for (int i = (1); i <= (n); i++) t[i] = 1000000;
    for (int i = (1); i <= (n); i++)
      if (int((b[i]).size())) {
        b[i].push_back(n + 1);
        int Max = 0, pre = 0;
        for (int j = (0); j <= (int((b[i]).size()) - 1); j++) {
          int diff = b[i][j] - pre;
          Max = max(Max, diff);
          pre = b[i][j];
        }
        t[Max] = min(t[Max], i);
      }
    for (int i = (2); i <= (n); i++) t[i] = min(t[i], t[i - 1]);
    for (int i = (1); i <= (n); i++)
      if (t[i] == 1000000) t[i] = -1;
    for (int i = (1); i <= (n); i++) cout << t[i] << ' ';
    cout << "\n";
  }
  return 0;
}
