#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> t[200005];
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    t[u].push_back(v);
    t[v].push_back(u);
  }
  int c[200005];
  for (int i = 1; i <= n; i++) cin >> c[i];
  int edges = 0, cnt[200005] = {0};
  for (int i = 1; i <= n; i++) {
    for (auto it : t[i]) {
      if (c[i] != c[it]) {
        cnt[i]++;
        cnt[it]++;
        edges++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == edges) {
      cout << "YES\n" << i << "\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
