func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 200007, inf = 0x3f3f3f3f;   vector<int> edges[N];   int d[N];   void bfs(int s) {     queue<int> q;     q.push(s);     memset(d, -1, sizeof d);     d[s] = 0;     while (q.size()) {       int u = q.front();       q.pop();       for (int v : edges[u]) {         if (d[v] == -1) {           q.push(v);           d[v] = d[u] + 1;         }       }     }   }   void no() {     cout <<  No  << endl;     exit(0);   }   int main() {     ios::sync_with_stdio(false);     srand(time(NULL));     int n;     cin >> n;     if (n == 1) {       cout <<  Yes  << endl;       return 0;     }     for (int i = 0; i < n - 1; ++i) {       int u, v;       cin >> u >> v;       edges[u].push_back(v);       edges[v].push_back(u);     }     vector<int> vec;     int a;     for (int i = 0; i < n; ++i) {       cin >> a;       vec.push_back(a);     }     memset(d, -1, sizeof d);     int t = 0;     d[1] = 0;     if (vec[0] != 1) no();     for (int i = 0; i < n; ++i) {       if (d[vec[i]] == -1) no();       ++t;       for (int v : edges[vec[i]]) {         if (d[v] == -1) d[v] = t;       }     }     for (int i = 1; i < n; ++i) {       if (d[vec[i]] < d[vec[i - 1]]) no();     }     cout <<  Yes  << endl;   }   