#include <bits/stdc++.h>
using namespace std;
int n, s, k2 = -1;
vector<vector<int> > g(1e5);
vector<int> c(1e5);
queue<int> q;
int dfs(int s, int n) {
  vector<bool> u(n, false);
  int k = 0, k1 = -1;
  u[s] = true;
  q.push(s);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < g[v].size(); i++) {
      int to = g[v][i];
      if (!u[to]) {
        u[to] = true;
        q.push(to);
        if (v != s && c[to] != c[v]) {
          k1 = v;
          if (k2 == -1) {
            k2 = to;
          }
          return k1;
        }
      }
    }
  }
  return k1;
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    g[--x].push_back(--y);
    g[y].push_back(x);
  }
  for (int i = 0; i < n; i++) cin >> c[i];
  int h = dfs(0, n);
  if (h == -1) {
    cout << "YES" << endl;
    cout << 1;
  } else {
    int h1 = dfs(h, n);
    if (h1 == -1) {
      cout << "YES" << endl;
      cout << h + 1;
    } else {
      if (dfs(h1, n) == -1) {
        cout << "YES" << endl;
        cout << h1 + 1;
      } else {
        cout << "NO";
      }
    }
  }
  return 0;
}
