#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 0x7fffffff;
int dis[300010], a[300010], ans[300010];
void solve() {
  int n;
  cin >> n;
  unordered_map<int, int> last;
  for (int i = 1; i <= n; i++) {
    dis[i] = 0;
    ans[i] = -1;
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    dis[a[i]] = max(dis[a[i]], i - last[a[i]]);
    last[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    dis[i] = max(dis[i], n - last[i] + 1);
    for (int j = dis[i]; j <= n; j++) {
      if (ans[j] == -1) {
        ans[j] = i;
      } else {
        break;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
