#include <bits/stdc++.h>
using namespace std;
const long double CHANGE = 1e-8;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const int nax = 1e5 + 5;
vector<int> w[nax];
int col[nax];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    w[a].push_back(b);
    w[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &col[i]);
  int bad = 0;
  for (int i = 1; i <= n; ++i)
    for (int b : w[i])
      if (i < b && col[i] != col[b]) ++bad;
  for (int i = 1; i <= n; ++i) {
    int tmp = 0;
    for (int b : w[i])
      if (col[i] != col[b]) ++tmp;
    if (tmp == bad) {
      puts("YES");
      printf("%d\n", i);
      return 0;
    }
  }
  puts("NO");
}
