#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int prime(int a) {
  if (a == 1)
    return 0;
  else {
    for (int i = 2; i <= a / 2; i++)
      if (a % i == 0) return 0;
    return 1;
  }
}
int power(int a, int b) {
  if (!b) return 1;
  int t = power(a, b / 2);
  return b % 2 ? t * t * a : t * t;
}
int comb(int n, int k) {
  if (n == k || k == 0) return 1;
  if (n < k)
    return 0;
  else
    return comb(n - 1, k - 1) + comb(n - 1, k);
}
int fibo(int n) {
  int a[n];
  a[0] = 1;
  a[1] = 1;
  for (int i = 2; i < n; i++) a[i] = a[i - 1] + a[i - 2];
  return a[n - 1];
}
int fact(int n) {
  int a[n + 1];
  a[0] = 1;
  for (int i = 1; i <= n; i++) a[i] = a[i - 1] * i;
  return a[n];
}
const int N = 1e6 + 6;
int a[N], b[N], c[N], ans[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, t = 0;
  cin >> n;
  for (int i = 1; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i < n; i++) {
    if (c[a[i]] != c[b[i]]) {
      t++;
      ans[a[i]]++;
      ans[b[i]]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i] == t) {
      cout << "YES\n" << i;
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
