func_code_string: #include <bits/stdc++.h>   using namespace std;   struct EDGE {     int to, next;   } e[400005];   int head[200005], cnt, c[200005], deg[200005];   inline int read() {     int x = 0;     char ch = getchar();     while (ch >  9  || ch <  0 ) ch = getchar();     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x;   }   void addedge(int x, int y) {     ++cnt;     e[cnt].to = y;     e[cnt].next = head[x];     head[x] = cnt;     ++cnt;     e[cnt].to = x;     e[cnt].next = head[y];     head[y] = cnt;   }   int main() {     int n = read();     cnt = 0;     for (int i = 1; i < n; i++) {       int x = read(), y = read();       addedge(x, y);     }     for (int i = 1; i <= n; i++) c[i] = read();     cnt = 0;     for (int i = 1; i <= n; i++)       for (int x = head[i]; x; x = e[x].next)         if (c[i] != c[e[x].to]) {           deg[i]++;           deg[e[x].to]++;           cnt++;         }     if (!cnt)       cout <<  YES n  << 1 << endl;     else {       int i = 1;       for (; i <= n; i++)         if (deg[i] == cnt) break;       if (i <= n)         cout <<  YES n  << i << endl;       else         cout <<  NO n  << endl;     }   }   