func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   const long long mod = 1e9 + 7;   long long powr(long long a, long long b) {     long long x = 1 % mod;     a %= mod;     while (b) {       if (b & 1) x = (x * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return x;   }   long long inv(long long a) { return powr(a, mod - 2); }   map<int, int> mymap, mymap2;   int par[maxn];   int val[maxn];   int main() {     int n;     cin >> n;     int x;     map<int, int>::iterator it1, it2;     int mx = 0, mn = 1e9 + 10;     int maxi = 1, mini = 1;     for (int i = 1; i <= n; i++) {       cin >> x;       if (i == 1) mx = mn = x;       val[i] = x;       if (i > 1) {         if (x > mx) {           par[i] = maxi;           maxi = i;           mx = x;         } else if (x < mn) {           par[i] = mini;           mini = i;           mn = x;         } else {           it2 = mymap.upper_bound(x);           int x = it2->second;           it2--;           int y = it2->second;           par[i] = max(x, y);         }         cout << val[par[i]] <<    ;       }       mymap[x] = i;     }     return 0;   }   