#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int c[N], ctr[N] = {0};
vector<pair<int, int> > candidates, edges;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    edges.push_back({u, v});
  }
  for (int i = 1; i <= n; ++i) cin >> c[i];
  for (auto &i : edges) {
    if (c[i.first] != c[i.second]) candidates.push_back(i);
  }
  if (candidates.empty()) {
    cout << "YES\n1";
    return 0;
  }
  int m = candidates.size();
  for (auto &i : candidates) {
    ctr[i.first]++;
    ctr[i.second]++;
  }
  for (int i = 1; i <= n; ++i) {
    if (ctr[i] == m) {
      cout << "YES\n" << i;
      return 0;
    }
  }
  cout << "NO";
}
