func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int i, a[n];       map<int, pair<int, int> > m;       for (i = 0; i < n; i++) {         cin >> a[i];       }       int vis[n + 1];       memset(vis, -1, sizeof(vis));       for (i = 0; i < n; i++) {         if (m.find(a[i]) == m.end()) {           pair<int, int> p;           p.first = i;           p.second = i + 1;           m[a[i]] = p;         } else {           pair<int, int> p = m[a[i]];           p.second = max(p.second, i - p.first);           p.first = i;           m[a[i]] = p;         }       }       map<int, pair<int, int> >::iterator it;       for (it = m.begin(); it != m.end(); it++) {         pair<int, int> p = it->second;         int i = p.first;         int x = max(p.second, n - i);         if (vis[x] == -1)           vis[x] = it->first;         else           vis[x] = min(vis[x], it->first);       }       for (i = 1; i <= n; i++) {         if (vis[i] == -1)           cout << vis[i] <<    ;         else {           int temp = vis[i];           while (i + 1 <= n && (vis[i + 1] == -1 || vis[i + 1] >= temp)) {             cout << temp <<    ;             i++;           }           cout << temp <<    ;         }       }       cout << endl;     }   }   