#include <bits/stdc++.h>
using namespace std;
int n;
int mk[200000];
int u[200000], v[200000];
int col[200000];
int main() {
  int m = 0;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    u[i] = x;
    v[i] = y;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &col[i]);
  }
  bool f = false;
  int ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    if (col[u[i]] != col[v[i]]) {
      mk[u[i]]++;
      mk[v[i]]++;
      m++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (mk[i] == m) f = true, ans = i;
  }
  if (f) {
    printf("YES\n%d\n", ans);
  } else
    printf("NO\n");
  return 0;
}
