#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int n, a[N], l[N], r[N], s[N], sum;
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) cin >> l[i] >> r[i];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i < n; i++)
    if (a[l[i]] != a[r[i]]) {
      sum++;
      s[l[i]]++;
      s[r[i]]++;
    }
  for (int i = 1; i <= n; i++)
    if (s[i] >= sum) {
      cout << "YES\n" << i << "\n";
      return 0;
    }
  cout << "NO\n";
  return 0;
}
