#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
int a[N];
int b[N];
int edge[N][2];
int main() {
  int n = 0;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u = 0;
    int v = 0;
    scanf("%d %d", &u, &v);
    edge[i][0] = u;
    edge[i][1] = v;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[edge[i][0]] == a[edge[i][1]]) continue;
    ++cnt;
    ++b[edge[i][0]];
    ++b[edge[i][1]];
  }
  for (int i = 1; i <= n; ++i) {
    if (b[i] == cnt) {
      printf("YES\n%d\n", i);
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
