func_code_string: #include <bits/stdc++.h>   using namespace std;   int t = 0;   int d[300000];   int par[300000];   int t1[300000];   int t2[300000];   void dfs(int s, vector<vector<int> > &ed, int y) {     d[s] = y;     t1[s] = t++;     for (int i = 0; i < ed[s].size(); i++) {       if (ed[s][i] != par[s]) {         par[ed[s][i]] = s;         dfs(ed[s][i], ed, y + 1);       }     }     t2[s] = t++;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, m;     cin >> n >> m;     vector<vector<int> > v(n);     int f, s;     for (int i = 1; i < n; i++) {       cin >> f >> s;       f--;       s--;       v[f].push_back(s);       v[s].push_back(f);     }     for (int i = 0; i < n; i++) {       sort(v[i].begin(), v[i].end());     }     par[0] = -1;     dfs(0, v, 0);     for (int i = 0; i < m; i++) {       cin >> f;       vector<int> h(f);       for (int j = 0; j < f; j++) {         cin >> h[j];         h[j]--;       }       int u = 0;       for (int j = 0; j < f; j++) {         if (d[h[j]] > d[u]) {           u = h[j];         }       }       int flag = 1;       for (int j = 0; j < f; j++) {         if (!((t1[h[j]] <= t1[u] && t2[h[j]] >= t2[u]) ||               (t1[par[h[j]]] <= t1[u] && t2[par[h[j]]] >= t2[u]))) {           flag = 0;           break;         }       }       if (flag == 0) {         cout <<  NO n ;       } else {         cout <<  YES n ;       }     }     return 0;   }   