func_code_string: #include <bits/stdc++.h>   using namespace std;   const double eps = 1e-10;   const double pi = 3.1415926535897932;   const double eln = 2.718281828459045;   vector<int> a[200005];   int p[200005], b[200005], od[200005];   void second(int m, int dah) {     p[m] = dah;     b[m] = 1;     for (int i = 0; i < a[m].size(); ++i) {       if (!b[a[m][i]]) {         second(a[m][i], dah + 1);       }     }   }   int main() {     ios::sync_with_stdio(false);     int n, x, y;     cin >> n;     for (int i = 0; i < n - 1; ++i) {       cin >> x >> y;       a[x].push_back(y);       a[y].push_back(x);     }     second(1, 1);     int maxx = 0;     int first = 0, st, hh;     for (int i = 0; i < n; ++i) {       cin >> x;       if (p[x] > maxx) {         hh = od[x];         maxx = p[x];         st = 1;         for (int j = 0; j < a[x].size(); ++j) {           if (!od[a[x][j]]) {             od[a[x][j]] = st;           }         }       } else if (p[x] == maxx) {         if (od[x] < hh) {           cout <<  No ;           return 0;         }         hh = max(hh, od[x]);         st++;         for (int j = 0; j < a[x].size(); ++j) {           if (!od[a[x][j]]) {             od[a[x][j]] = st;           }         }       } else if (p[x] < maxx) {         cout <<  No ;         return 0;       }     }     cout <<  Yes ;     return 0;   }   