#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    vector<int> last(n + 1, 0), gap(n + 1, 0), v(n + 1);
    for (int i = 1; i <= n; i++) {
      cin >> v[i];
      gap[v[i]] = max(gap[v[i]], i - last[v[i]]);
      last[v[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      gap[i] = max(gap[i], n + 1 - last[i]);
    }
    vector<int> res(n + 1, -1);
    for (int i = 1; i <= n; i++) {
      for (int j = gap[i]; j <= n; j++) {
        if (res[j] == -1)
          res[j] = i;
        else
          break;
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << res[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
