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