func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   const long long xx = 2e5;   vector<long long> g1[xx + 10];   vector<long long> g2[xx + 10];   long long v[xx + 10];   long long p1[xx], p2[xx];   void make_first(long long h) {     long long node = 1;     for (long long i = 1; i < h + 1; i++) {       if (v[i - 1] == 1) {         long long root = node;         for (long long j = 0; j < v[i]; j++) {           ++node;           g1[root].push_back(node);         }       } else {         long long r2 = node;         long long r1 = node - 1;         ++node;         g1[r1].push_back(node);         for (long long j = 0; j < v[i] - 1; j++) {           ++node;           g1[r2].push_back(node);         }       }     }   }   long long mx_node = 0;   void make_second(long long h) {     long long node = 1;     for (long long i = 1; i < h + 1; i++) {       long long root = node;       for (long long j = 0; j < v[i]; j++) {         ++node;         g2[root].push_back(node);         mx_node = max(mx_node, node);       }     }   }   void dfs1(long long r, long long p) {     for (auto i : g2[r]) {       if (i != p) {         p1[i] = r;         dfs1(i, r);       }     }   }   void dfs2(long long r, long long p) {     for (auto i : g1[r]) {       if (i != p) {         p2[i] = r;         dfs2(i, r);       }     }   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long h;     cin >> h;     for (long long i = 0; i < h + 1; i++) {       cin >> v[i];     }     bool per = true;     if (h >= 2) {       for (long long i = 2; i < h + 1; i++) {         if (v[i] > 1 && v[i - 1] > 1) {           per = false;           break;         }       }     }     if (per) {       cout <<  perfect  <<   n ;       return 0;     }     make_first(h);     make_second(h);     dfs1(1, -1);     dfs2(1, -1);     cout <<  ambiguous  <<   n ;     for (long long i = 1; i <= mx_node; i++) cout << p1[i] <<    ;     cout <<   n ;     for (long long i = 1; i <= mx_node; i++) cout << p2[i] <<    ;     cout <<   n ;   }   