#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[100005];
int n, t, v[100005], c[100005];
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; ++i) cin >> a[i].first >> a[i].second;
  for (int i = 0; i < n; ++i) cin >> c[i + 1];
  for (int i = 0; i < n - 1; ++i) {
    if (c[a[i].first] != c[a[i].second]) {
      t++;
      v[a[i].first]++;
      v[a[i].second]++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (v[i] == t) {
      cout << "YES\n" << i << '\n';
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
