#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    vector<int> ans(n + 1, -1);
    for (int i = 0; i < n; i++) cin >> a[i];
    map<int, int> m;
    vector<int> interval(n + 1, -1);
    for (int i = 1; i <= n; i++) m[i] = -1;
    for (int i = 0; i < n; i++) {
      interval[a[i]] = max(i - m[a[i]], interval[a[i]]);
      m[a[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      interval[i] = max(n - m[i], interval[i]);
    }
    int l = n;
    for (int i = 1; i <= n; i++) {
      if (interval[i] > n) continue;
      int ivl = interval[i];
      for (int j = ivl; j <= l; j++) {
        if (ans[j] == -1) ans[j] = i;
      }
      l = min(l, ivl - 1);
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
  }
}
