#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int last[N];
int a[N];
int pos[N];
int num[N];
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int i;
    memset(last, 0, sizeof last);
    memset(pos, 0, sizeof pos);
    memset(num, 0x3f, sizeof num);
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 1; i <= n; i++) {
      int tmp = i - last[a[i]];
      pos[a[i]] = max(pos[a[i]], tmp);
      last[a[i]] = i;
    }
    for (i = 1; i <= n; i++) {
      pos[a[i]] = max(pos[a[i]], n + 1 - last[a[i]]);
    }
    for (i = 1; i <= n; i++) {
      num[pos[a[i]]] = min(num[pos[a[i]]], a[i]);
    }
    for (i = 1; i <= n; i++) {
      num[i] = min(num[i], num[i - 1]);
      if (num[i] == 0x3f3f3f3f) {
        cout << -1 << " ";
      } else {
        cout << num[i] << " ";
      }
    }
    cout << endl;
  }
}
