#include <bits/stdc++.h>
int main() {
  int i, n, u[100005], v[100005], c[100005], m = 0, du[100005];
  scanf("%d", &n);
  memset(du, 0, sizeof(du));
  for (i = 1; i < n; i++) scanf("%d %d", &u[i], &v[i]);
  for (i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (i = 1; i < n; i++) {
    if (c[u[i]] != c[v[i]]) {
      m++;
      du[u[i]]++;
      du[v[i]]++;
    }
  }
  for (i = 1; i <= n; i++)
    if (du[i] == m) {
      printf("YES\n%d\n", i);
      return 0;
    }
  printf("NO\n");
  return 0;
}
