#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const int minn = 0xc0c0c0c0;
vector<int> s[maxn];
int n, t, x, a[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 0; i <= n; i++) {
      a[i] = inf;
      s[i].clear();
    }
    for (int i = 1; i <= n; i++) {
      cin >> x;
      s[x].push_back(i);
    }
    for (int i = 1; i <= n; i++) {
      if (!s[i].empty()) {
        int tmp = 0;
        for (int j = 1; j < s[i].size(); j++)
          tmp = max(tmp, s[i][j] - s[i][j - 1]);
        tmp = max(tmp, s[i].front());
        tmp = max(tmp, n - s[i].back() + 1);
        a[tmp] = min(a[tmp], i);
      }
    }
    for (int i = 2; i <= n; i++) a[i] = min(a[i], a[i - 1]);
    for (int i = 1; i <= n; i++) {
      if (a[i] != inf)
        cout << a[i] << " ";
      else
        cout << "-1"
             << " ";
    }
    cout << endl;
  }
  return 0;
}
