#include <bits/stdc++.h>
using namespace std;
long long t, n, x, j;
pair<long long, long long> ans[300005];
long long val[300005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n;
    map<long long, long long> dis, lst;
    dis.clear();
    lst.clear();
    for (int i = 1; i <= n; i++)
      cin >> x, dis[x] = max(dis[x], i - lst[x]), lst[x] = i;
    j = 0;
    for (auto i : lst) {
      dis[i.first] = max(dis[i.first], (n + 1) - i.second);
      ans[j++] = {dis[i.first], -i.first};
    }
    ans[j++] = {0, 1};
    sort(ans, ans + j);
    reverse(ans, ans + j);
    j = 0;
    for (int i = n; i > 0; i--) {
      while (i < ans[j].first) j++;
      val[i - 1] = -ans[j].second;
    }
    cout << val[0] << " ";
    for (int i = 1; i < n; i++) {
      if (val[i - 1] > -1) val[i] = min(val[i - 1], val[i]);
      cout << val[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
