func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T a, T b) {     return b == 0 ? a : gcd(b, a % b);   }   const int MAXN = 1e5 + 1e4;   int n, pos_ = 0;   vector<int> g[MAXN];   vector<int> a[MAXN];   vector<int> ans;   vector<vector<int>> t(4 * MAXN);   vector<int> parent(MAXN), depth(MAXN), heavy(MAXN, -1), pos(MAXN), head(MAXN);   int dfs(int v) {     int sz = 1;     int h_sz = 0;     for (int u : g[v]) {       if (parent[v] == u) {         continue;       }       parent[u] = v;       depth[u] = depth[v] + 1;       int cur_sz = dfs(u);       sz += cur_sz;       if (h_sz < cur_sz) {         h_sz = cur_sz;         heavy[v] = u;       }     }     return sz;   }   void hld(int v, int root) {     head[v] = root;     pos[v] = pos_++;     ;     if (heavy[v] != -1) {       hld(heavy[v], root);     }     for (int u : g[v]) {       if (u == heavy[v] || u == parent[v]) {         continue;       }       hld(u, u);     }   }   void build(int v = 1, int l = 0, int r = n) {     if (r - l == 1) {       t[v] = a[l];       while (((int32_t)(t[v]).size()) > 10) {         t[v].pop_back();       };       return;     }     int m = (l + r) / 2;     build(v * 2, l, m);     build(v * 2 + 1, m, r);     t[v].resize(20, INT_MAX);     merge((t[v * 2]).begin(), (t[v * 2]).end(), (t[v * 2 + 1]).begin(),           (t[v * 2 + 1]).end(), t[v].begin());     while (((int32_t)(t[v]).size()) > 10 ||            t[v][((int32_t)(t[v]).size()) - 1] == INT_MAX) {       t[v].pop_back();     }   }   void get_ans(int ql, int qr, int v = 1, int l = 0, int r = n) {     if (ql <= l && r <= qr) {       vector<int> ans_new(20, INT_MAX);       merge((ans).begin(), (ans).end(), (t[v]).begin(), (t[v]).end(),             ans_new.begin());       for (int i = 0; i < 20; i++) {         ;       }       while (((int32_t)(ans_new).size()) > 10 ||              ans_new[((int32_t)(ans_new).size()) - 1] == INT_MAX) {         ans_new.pop_back();       }       ans = ans_new;       return;     }     if (qr <= l || r <= ql) {       return;     }     int m = (l + r) / 2;     get_ans(ql, qr, v * 2, l, m);     get_ans(ql, qr, v * 2 + 1, m, r);   }   void query(int a, int b) {     while (head[a] != head[b]) {       if (depth[head[a]] > depth[head[b]]) {         swap(a, b);       };       get_ans(pos[head[b]], pos[b] + 1);       b = parent[head[b]];     }     if (depth[a] > depth[b]) {       swap(a, b);     };     get_ans(pos[a], pos[b] + 1);   }   int32_t main() {     {       cin.tie(0);       cout.tie(0);       ios_base::sync_with_stdio(0);     };     int m, q;     cin >> n >> m >> q;     for (int i = 1; i < n; i++) {       int v, u;       cin >> v >> u;       v--;       u--;       g[u].push_back(v);       g[v].push_back(u);     }     dfs(0);     hld(0, 0);     for (int i = 0; i < m; i++) {       int tmp;       cin >> tmp;       ;       a[pos[tmp - 1]].push_back(i + 1);     }     build();     while (q--) {       int v, u, a;       cin >> v >> u >> a;       v--;       u--;       ans.clear();       query(v, u);       ;       int k = min(a, ((int32_t)(ans).size()));       cout << k;       for (int i = 0; i < k; i++) {         cout <<     << ans[i];       }       cout <<   n ;     }     return 0;   }   