#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<vector<int> > v1(n + 1);
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      v1[x].push_back(i);
    }
    int a1[n];
    memset(a1, -1, sizeof(a1));
    int m1[n + 1];
    memset(m1, -1, sizeof(m1));
    for (int i = 0; i < n + 1; i++) {
      if (v1[i].size() > 0) {
        int m = v1[i][0] - (-1);
        for (int j = 1; j < v1[i].size(); j++) {
          m = max(m, v1[i][j] - v1[i][j - 1]);
        }
        m = max(m, n - v1[i][v1[i].size() - 1]);
        m1[i] = m;
      }
    }
    for (int i = 1; i < n + 1; i++) {
      if (m1[i] != -1) {
        for (int j = m1[i] - 1; j < n; j++) {
          if (a1[j] == -1) {
            a1[j] = i;
          } else
            break;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      cout << a1[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
