#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    int a[300005];
    int last[300005];
    int d[300005];
    int m = 1e9;
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      m = min(m, a[i]);
    }
    for (int i = 0; i <= n; ++i) {
      d[i] = -1;
      last[i] = -1;
    }
    for (int i = 0; i < n; ++i) {
      d[a[i]] = max(d[a[i]], i - 1 - last[a[i]]);
      last[a[i]] = i;
    }
    for (int i = 0; i < n; ++i) {
      d[a[i]] = max(d[a[i]], n - 1 - last[a[i]]);
    }
    int ans[300005];
    for (int i = 0; i <= n; ++i) ans[i] = 1e9;
    for (int i = 0; i < n; ++i) {
      ans[d[a[i]] + 1] = min(ans[d[a[i]] + 1], a[i]);
    }
    ans[n] = m;
    for (int i = 1; i <= n; ++i) {
      ans[i] = min(ans[i], ans[i - 1]);
    }
    for (int i = 1; i <= n; ++i) {
      if (ans[i] != 1e9)
        cout << ans[i] << ' ';
      else
        cout << -1 << ' ';
    }
    cout << '\n';
  }
}
