func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, x, y;     cin >> n;     vector<int> adj[n + 1], deg(n + 1, 0);     vector<pair<int, int>> input;     for (int i = 0; i < n - 1; i++) {       cin >> x >> y;       input.push_back(make_pair(x, y));       adj[x].push_back(y);       adj[y].push_back(x);       deg[x]++;       deg[y]++;     }     vector<pair<int, int>> s;     for (int i = 1; i <= n; i++) {       s.push_back(make_pair(deg[i], i));     }     sort(s.begin(), s.end());     int number = 0;     map<pair<int, int>, int> m;     for (auto x : s) {       int degree = x.first;       int vertex = x.second;       for (int k : adj[vertex]) {         pair<int, int> temp = {k, vertex};         pair<int, int> revr = {vertex, k};         if (m.find(temp) == m.end()) {           m[temp] = number;           m[revr] = number;           number++;         }       }     }     for (auto x : input) {       pair<int, int> temp = {x.first, x.second};       cout << m[temp] <<   n ;     }   }   