func_code_string: #include <bits/stdc++.h>   using namespace std;   int depth[200005], dad[200005];   int dep = 0;   void node_depth(vector<int> vec[], int i) {     dep = depth[i] + 1;     for (auto j : vec[i - 1]) {       if (j != dad[i]) {         depth[j] = dep;       }     }     for (auto j : vec[i - 1]) {       if (j != dad[i]) {         node_depth(vec, j);       }     }   }   int entry[200005], exiit[200005];   int timer = 0;   void ancestor(vector<int> vec[], int i) {     entry[i] = timer;     timer++;     for (auto j : vec[i - 1]) {       if (j != dad[i]) {         dad[j] = i;         ancestor(vec, j);       }     }     exiit[i] = timer;     timer++;   }   bool isParent(int a, int b) {     return (entry[a] <= entry[b] && exiit[a] >= exiit[b]);   }   signed idiot() {     depth[1] = 0;     int n, m;     cin >> n >> m;     vector<int> edge[n];     dad[1] = 1;     for (int i = 0; i < n - 1; i++) {       int u, v;       cin >> u >> v;       edge[u - 1].push_back(v);       edge[v - 1].push_back(u);     }     ancestor(edge, 1);     node_depth(edge, 1);     while (m--) {       int k;       cin >> k;       int temp = 1;       vector<int> ve;       while (k--) {         int vi;         cin >> vi;         if (depth[vi] > depth[temp]) {           temp = vi;         }         ve.push_back(vi);       }       bool path = true;       for (auto i : ve) {         if (!isParent(dad[i], temp)) {           path = false;           break;         }       }       cout << (path ?  YES  :  NO ) <<   n ;     }     return 0;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int test_case = 1;     while (test_case--) idiot();     return 0;   }   