#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<vector<int>> g(n);     vector<pair<int, int>> e(n - 1);     for (int i = 0; i < n - 1; ++i) {       int u, v;       cin >> u >> v;       --u;       --v;       g[u].push_back(v);       g[v].push_back(u);       e[i] = make_pair(u, v);     }     vector<int> col(n);     for (int &i : col) {       cin >> i;     }     int diff = 0;     for (auto i : e) {       if (col[i.first] != col[i.second]) {         ++diff;       }     }     for (int i = 0; i < n; ++i) {       int ctr = 0;       for (int j : g[i]) {         if (col[i] != col[j]) {           ++ctr;         }       }       if (ctr == diff) {         cout <<  YES n  << i + 1;         return 0;       }     }     cout <<  NO ;     return 0;   }   