#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
int a[maxn], b[maxn], c[maxn], d[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    memset(d, 0, sizeof(d));
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      c[a[i]] = max(c[a[i]], i - b[a[i]]);
      b[a[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      c[a[i]] = max(n - b[a[i]] + 1, c[a[i]]);
    }
    for (int i = 1; i <= n; i++) {
      if (d[c[i]] == 0) {
        d[c[i]] = i;
      } else {
        d[c[i]] = min(i, d[c[i]]);
      }
    }
    int ans = -1;
    for (int i = 1; i <= n; i++) {
      if (d[i] == 0 && ans == -1) {
        cout << ans << " ";
      } else if (ans == -1) {
        ans = d[i];
        cout << ans << " ";
      } else if (d[i] == 0) {
        cout << ans << " ";
      } else {
        ans = min(ans, d[i]);
        cout << ans << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
