#include <bits/stdc++.h>
using namespace std;
clock_t T;
constexpr auto EPS = 1e-7;
const int MOD = (int)1e9 + 7;
int dxn[] = {-1, -2, -2, -1, 1, 2, 2, 1};
int dyn[] = {-2, -1, 1, 2, 2, 1, -1, -2};
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
long long gcd(long long a, long long b) { return (a) ? gcd(b % a, a) : b; }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
void COME_BACK() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  COME_BACK();
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v, ans, mx;
    v.resize(n + 2), ans.resize(n + 2, 4e5), mx.resize(n + 2, -4e5);
    map<int, int> mp;
    for (int i = 1; i <= n; i++) cin >> v[i];
    for (int i = 1; i <= n; i++) {
      mx[v[i]] = max(mx[v[i]], i - mp[v[i]]);
      mp[v[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      mx[i] = max(mx[i], n + 1 - mp[i]);
      if (mx[i] != -4e5) ans[mx[i]] = min(i, ans[mx[i]]);
    }
    for (int i = 1; i <= n; i++) {
      ans[i] = min(ans[i], ans[i - 1]);
      if (ans[i] == 4e5)
        cout << -1 << " ";
      else
        cout << ans[i] << " ";
    }
    cout << "\n";
  }
  cerr << "Time : " << double(clock() - T) / CLOCKS_PER_SEC << "\n";
}
