#include <bits/stdc++.h>
using namespace std;
int flag;
int c[100001];
vector<vector<int> > adj(100001);
int dfs(int cur, int prev, int val) {
  int i;
  for (i = 0; i < adj[cur].size(); i++) {
    if (adj[cur][i] != prev) {
      if (c[adj[cur][i]] != c[cur] && cur != val) flag = 1;
      dfs(adj[cur][i], cur, val);
    }
  }
  return 0;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, val = -1, val1 = -1, i, u, v, j;
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < adj[i].size(); j++) {
      if (c[i] != c[adj[i][j]]) {
        val = i;
        val1 = adj[i][j];
        break;
      }
    }
  }
  if (val == -1) {
    cout << "YES" << endl;
    cout << 1 << endl;
  } else {
    flag = 0;
    dfs(val, -1, val);
    if (flag == 0) {
      cout << "YES" << endl;
      cout << val + 1 << endl;
      return 0;
    }
    flag = 0;
    dfs(val1, -1, val1);
    if (flag == 0) {
      cout << "YES" << endl;
      cout << val1 + 1 << endl;
      return 0;
    }
    cout << "NO" << endl;
  }
}
