func_code_string: #include <bits/stdc++.h>   using namespace std;   const int Maxn = 3e5 + 5;   const int inf = 1 << 29;   inline int min(int a, int b) { return a < b ? a : b; }   inline int max(int a, int b) { return a > b ? a : b; }   inline int R() {     char ch = getchar();     int x = 0;     bool f = 0;     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) f = 1;     for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);     if (f == 1) x = -x;     return x;   }   int a[Maxn], n, t, L[Maxn], N[Maxn], ans[Maxn];   bool vis[Maxn];   int main() {     t = R();     while (t--) {       n = R();       for (int i = 0; i <= n + 1; i++) {         ans[i] = inf;         N[i] = vis[i] = 0;       }       for (int i = 1; i <= n; i++) {         a[i] = R();         L[a[i]] = 0;       }       for (int i = 1; i <= n; i++) {         if (!L[a[i]])           L[a[i]] = i;         else {           N[L[a[i]]] = i;           L[a[i]] = i;         }       }       for (int i = 1; i <= n; i++)         if (N[i] == 0) N[i] = n + 1;       for (int i = 1; i <= n; i++)         if (!vis[i]) {           int M = i;           for (int p = i; N[p] != 0; p = N[p]) {             vis[p] = 1;             M = max(M, N[p] - p);           }           ans[M] = min(ans[M], a[i]);         }       ans[0] = inf;       for (int i = 1; i <= n; i++) ans[i] = min(ans[i], ans[i - 1]);       for (int i = 1; i <= n; i++) {         if (ans[i] == inf) ans[i] = -1;         printf( %d  , ans[i]);       }       puts(  );     }   }   