func_code_string: #include <bits/stdc++.h>   using namespace std;   map<int, int> lc, rc, pr;   set<int> nodes;   set<int>::iterator it;   vector<int> v;   int main() {     int n;     cin >> n;     int root;     cin >> root;     nodes.insert(root);     for (int i = 1; i < n; ++i) {       int x;       cin >> x;       v.push_back(x);       it = nodes.upper_bound(x);       if (it == nodes.end()) {         it--;         rc[*it] = x;         pr[x] = (*it);       } else if (it == nodes.begin()) {         lc[*it] = x;         pr[x] = (*it);       } else {         int ul = (*it);         it--;         int ll = (*it);         if (lc[ul])           rc[ll] = x, pr[x] = ll;         else           lc[ul] = x, pr[x] = ul;       }       nodes.insert(x);     }     for (int i = 0; i < v.size(); ++i) {       cout << pr[v[i]] <<    ;     }     return 0;   }   