func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int main() {     int n;     scanf( %d , &n);     vector<vector<pair<int, int>>> a(n);     for (int i = 0; i < n - 1; i++) {       int u, v;       scanf( %d %d , &u, &v);       --u, --v;       a[u].emplace_back(v, i);       a[v].emplace_back(u, i);     }     vector<int> lev(n, 1), pr(n);     function<void(int, int)> dfs = [&](int u, int p) {       pr[u] = p;       for (auto [v, id] : a[u]) {         if (v != p) {           lev[v] = 1 + lev[u];           dfs(v, u);         }       }     };     dfs(0, -1);     vector<vector<int>> sp(n, vector<int>(22, -1));     for (int i = 0; i < 22; i++) {       for (int j = 0; j < n; j++) {         if (i == 0) {           sp[j][i] = pr[j];         } else if (sp[j][i - 1] != -1) {           sp[j][i] = sp[sp[j][i - 1]][i - 1];         }       }     }     function<int(int, int)> lca = [&](int u, int v) {       if (lev[u] < lev[v]) {         swap(u, v);       }       int lg = 0;       while ((1 << lg) <= lev[u]) {         ++lg;       }       --lg;       for (int i = lg; i >= 0; i--) {         if (lev[u] >= lev[v] + (1 << i)) {           u = sp[u][i];         }       }       if (u == v) {         return u;       }       for (int i = lg; i >= 0; i--) {         if (sp[u][i] != sp[v][i]) {           u = sp[u][i];           v = sp[v][i];         }       }       return (u == v) ? u : pr[u];     };     int k;     scanf( %d , &k);     vector<int> val(n);     for (int i = 0; i < k; i++) {       int u, v;       scanf( %d %d , &u, &v);       --u, --v;       int g = lca(u, v);       ++val[u], ++val[v];       val[g] -= 2;     }     vector<int> ans(n - 1);     function<void(int, int)> dfs2 = [&](int u, int p) {       for (auto [v, id] : a[u]) {         if (v != p) {           dfs2(v, u);           val[u] += val[v];           ans[id] = val[v];         }       }     };     dfs2(0, -1);     for (int v : ans) {       printf( %d  , v);     }     puts(  );     return 0;   }   