#include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
  T b, e;
};
template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
}
struct debug {
  template <class T>
  debug& operator<<(const T&) {
    return *this;
  }
};
using ll = long long;
template <typename T>
void min_self(T& a, T b) {
  a = min(a, b);
}
template <typename T>
void max_self(T& a, T b) {
  a = max(a, b);
}
const int nax = 5e5 + 5;
int a[nax];
vector<int> pos[nax];
void tc() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pos[i + 1].clear();
  }
  for (int i = 0; i < n; i++) {
    pos[a[i]].push_back(i);
  }
  vector<int> ans(n + 1, n + 1);
  for (int x = 1; x <= n; x++) {
    if (pos[x].empty()) {
      continue;
    }
    int d = 1;
    for (int i = 1; i < (int)pos[x].size(); i++) {
      max_self(d, pos[x][i] - pos[x][i - 1]);
    }
    max_self(d, pos[x][0] + 1);
    max_self(d, n - pos[x].back());
    min_self(ans[d], x);
  }
  for (int i = 1; i <= n; i++) {
    min_self(ans[i], ans[i - 1]);
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i] == n + 1) {
      cout << "-1 ";
    } else {
      cout << ans[i] << " ";
    }
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    tc();
  }
}
