#include <bits/stdc++.h>
using namespace std;
long long binpow(long long a, long long b) {
  a %= 1000000007;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return res;
}
int main() {
  int t, n, a, i, j;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<int> end(n + 1, -1);
    vector<int> val(n + 1, 0);
    vector<int> ans(n, -1);
    for (i = 0; i < n; i++) {
      cin >> a;
      val[a] = max(val[a], i - end[a]);
      end[a] = i;
    }
    for (i = 1; i <= n; i++) val[i] = max(val[i], n - end[i]);
    for (i = 1; i <= n; i++) {
      for (j = val[i]; (ans[j - 1] == -1) && j <= n; j++) ans[j - 1] = i;
    }
    for (i = 0; i < n; i++) cout << ans[i] << " ";
    cout << endl;
  }
}
