func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   vector<int> edge[1005];   pair<int, int> ans[1005];   set<int> eQQ;   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n, a, b;     cin >> n;     for (int i = 1; i < n; ++i) {       cin >> a >> b;       if (b != n) return cout <<  NO n , 0;       edge[a].push_back(i);     }     for (int i = n - 1; i > 0; --i)       if (edge[i].empty()) eQQ.insert(i);     for (int i = n - 1, l; i >= 0; --i) {       l = n;       for (auto x : edge[i])         if (x == edge[i].back())           ans[x] = make_pair(l, i);         else {           auto p = eQQ.lower_bound(i);           if (p == eQQ.begin())             return cout <<  NO n , 0;           else             --p, ans[x] = make_pair(l, *p), l = *p, eQQ.erase(p);         }     }     cout <<  YES n ;     for (int i = 1; i < n; ++i)       cout << ans[i].first <<     << ans[i].second <<   n ;   }   