#include <bits/stdc++.h>
using std::max;
using std::min;
int T;
int n;
int a[(300000 + 5)];
int pre[(300000 + 5)];
int f[(300000 + 5)];
int ans[(300000 + 5)];
int Read() {
  int res = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar();
  return res;
}
int main() {
  T = Read();
  while (T--) {
    memset(pre, 0, sizeof pre);
    memset(f, 0, sizeof f);
    memset(ans, 0x3f3f3f3f, sizeof ans);
    n = Read();
    for (int i = 1; i <= n; ++i) a[i] = Read();
    for (int i = 1; i <= n; ++i) {
      f[a[i]] = max(f[a[i]], i - pre[a[i]]);
      pre[a[i]] = i;
    }
    for (int i = 1; i <= n; ++i) {
      if (!pre[i]) continue;
      f[i] = max(f[i], n - pre[i] + 1);
      ans[f[i]] = min(ans[f[i]], i);
    }
    for (int i = 1; i <= n; ++i) {
      ans[i] = min(ans[i], ans[i - 1]);
      printf("%d ", ans[i] == 0x3f3f3f3f ? -1 : ans[i]);
    }
  }
  return 0;
}
