#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10, m = N * 2;
vector<int> a[N];
int s[N];
int n;
int res[N];
inline void init() {
  for (int i = 1; i <= n; i++) res[i] = m;
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++) a[s[i]].push_back(i);
  for (int i = 1; i <= n; i++) a[i].push_back(n + 1);
  for (int i = 1; i <= n; i++) {
    int sum = -1, last = 0;
    for (int x : a[i]) {
      sum = max(sum, x - last);
      last = x;
    }
    if (~sum) res[sum] = min(res[sum], i);
  }
  int last = 0x7f7f7f;
  for (int i = 1; i <= n; i++) {
    if (res[i] > last)
      res[i] = last;
    else
      last = res[i];
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> s[i];
    init();
    for (int i = 1; i <= n; i++)
      if (res[i] != m)
        cout << res[i] << " ";
      else
        cout << "-1 ";
    puts("");
  }
  return 0;
}
