#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int n, sum;
int cnt[100005], from[100005], to[100005], c[100005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) scanf("%d%d", &from[i], &to[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (int i = 1; i < n; i++) {
    if (c[from[i]] != c[to[i]]) {
      cnt[from[i]]++;
      cnt[to[i]]++;
      sum++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == sum) {
      printf("YES\n%d\n", i);
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
