#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
int a[N], last[N], res[N], resk[N];
int main() {
  resk[0] = 0x3f3f3f3f;
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
      scanf("%d", &a[i]), last[a[i]] = -1, resk[i] = 0x3f3f3f3f;
    for (int i = 1; i <= n; ++i) {
      if (last[a[i]] == -1)
        res[a[i]] = i;
      else
        res[a[i]] = max(res[a[i]], i - last[a[i]]);
      last[a[i]] = i;
    }
    for (int i = 1; i <= n; ++i) res[a[i]] = max(res[a[i]], n - last[a[i]] + 1);
    for (int i = 1; i <= n; ++i) {
      resk[res[a[i]]] = min(resk[res[a[i]]], a[i]);
    }
    for (int i = 1; i <= n; ++i) resk[i] = min(resk[i], resk[i - 1]);
    for (int i = 1; i <= n; ++i)
      printf("%d ", (resk[i] == 0x3f3f3f3f ? -1 : resk[i]));
    puts("");
  }
  return 0;
}
