func_code_string: #include <bits/stdc++.h>   using namespace std;   long long mul(long long a, long long b) {     return ((a % 1000000007) * (b % 1000000007)) % 1000000007;   }   long long power(long long a, long long b) {     if (b == 0) return 1;     if (b == 1) return a;     long long temp = power(a, b / 2);     if (b % 2 == 0)       return mul(temp, temp);     else       return mul(mul(temp, temp), a);   }   vector<long long> g[100005];   long long color[100005];   long long curr_color, ok;   void dfs(long long node, long long par) {     ok = ok && (color[node] == curr_color);     for (long long i = 0; i < g[node].size(); i++) {       if (g[node][i] != par) {         dfs(g[node][i], node);       }     }   }   long long solve(long long node) {     long long ans = 1;     ok = 1;     for (long long i = 0; i < g[node].size(); i++) {       curr_color = color[g[node][i]];       dfs(g[node][i], node);       ans = ans && ok;     }     return ans;   }   int main() {     long long n, i, x, a, b;     cin >> n;     for (i = 0; i < n - 1; i++) {       cin >> a >> b;       g[a].push_back(b);       g[b].push_back(a);     }     for (i = 0; i < n; i++) cin >> color[i + 1];     long long root1 = -1, root2 = -1;     for (i = 1; i <= n; i++) {       for (long long j = 0; j < g[i].size(); j++) {         if (color[i] != color[g[i][j]]) {           root1 = i;           root2 = g[i][j];         }       }     }     if (root1 == -1) {       cout <<  YES  << endl;       cout << 1 << endl;       return 0;     }     if (solve(root1)) {       cout <<  YES  << endl;       cout << root1 << endl;       return 0;     }     if (solve(root2)) {       cout <<  YES  << endl;       cout << root2 << endl;       return 0;     }     cout <<  NO  << endl;     return 0;   }   