#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, col[100001], cnt = 0, di[100001];
  scanf("%d", &n);
  memset(di, 0, sizeof(di));
  vector<int> G[100001];
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &a, &b);
    G[a].push_back(b);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &col[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < G[i].size(); j++) {
      int u = i, v = G[i][j];
      if (col[u] != col[v]) {
        di[u]++;
        di[v]++;
        cnt++;
      }
    }
  }
  if (cnt == 0)
    printf("YES\n1\n");
  else {
    int flag = 0;
    for (int i = 1; i <= n; i++) {
      if (di[i] == cnt) {
        printf("YES\n%d\n", i);
        flag = 1;
        break;
      }
    }
    if (!flag) printf("NO\n");
  }
  return 0;
}
