#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 10;
int t, n;
int LastVis[MAXN];
int Filled[MAXN];
int Min[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; ++i) LastVis[i] = 0, Min[i] = -1;
    for (int a, i = 1; i <= n; ++i) {
      cin >> a;
      Min[a] = max(Min[a], i - LastVis[a]);
      LastVis[a] = i;
      Filled[i] = 0;
    }
    for (int i = 1; i <= n; ++i) {
      Min[i] = max(Min[i], n + 1 - LastVis[i]);
    }
    for (int i = 1; i <= n; ++i) {
      if (Min[i] == -1) continue;
      if (!Filled[Min[i]]) Filled[Min[i]] = i;
    }
    for (int Laa = 0x3f3f3f3f, Lst = -1, i = 1; i <= n; ++i) {
      if (Filled[i] && Filled[i] < Laa) Lst = Filled[i], Laa = Filled[i];
      cout << Lst << " ";
    }
    cout << endl;
  }
  return 0;
}
