#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int ans[N];
vector<int> pos[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) pos[i].clear();
    for (int i = 1; i <= n; ++i) {
      int x;
      cin >> x;
      pos[x].push_back(i);
      ans[i] = -1;
    }
    for (int i = 1; i <= n; ++i) {
      int size = pos[i].size();
      if (size) {
        int res = max(pos[i][0], n - pos[i][size - 1] + 1);
        for (int j = 0; j < size - 1; ++j)
          res = max(res, pos[i][j + 1] - pos[i][j]);
        for (int j = res; j <= n; ++j) {
          if (ans[j] == -1)
            ans[j] = i;
          else
            break;
        }
      }
    }
    for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
  }
  return 0;
}
