#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010;
const int mod = 1e9 + 7;
const int hash_bit = 13331;
int t;
int n;
int tmp;
int a[maxn];
int pre1[maxn], pre2[maxn];
int mx[maxn];
int ans[maxn];
void prepare() {
  for (int i = 1; i <= n; i++) {
    pre1[i] = 0;
    pre2[i] = n + 1;
    mx[i] = 0;
    ans[i] = -1;
  }
}
void solve() {
  scanf("%d", &n);
  prepare();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    tmp = a[i];
    if (i - pre1[tmp] > mx[tmp]) {
      mx[tmp] = i - pre1[tmp];
    }
    pre1[tmp] = i;
  }
  for (int i = n; i >= 1; i--) {
    tmp = a[i];
    if (pre2[tmp] - i > mx[tmp]) {
      mx[tmp] = pre2[tmp] - i;
    }
    pre2[tmp] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (ans[mx[i]] == -1) ans[mx[i]] = i;
  }
  for (int i = 2; i <= n; i++) {
    if (ans[i] > ans[i - 1] && ans[i - 1] != -1) {
      ans[i] = ans[i - 1];
    } else if (ans[i] == -1 && ans[i - 1] != -1) {
      ans[i] = ans[i - 1];
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    solve();
  }
}
