#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> e;
int c[100010];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    e.push_back({a, b});
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  int e2 = 0;
  static int d[100010];
  for (int i = 0; i < n - 1; i++) {
    if (c[e[i].first] != c[e[i].second]) {
      e2++;
      d[e[i].first]++;
      d[e[i].second]++;
    }
  }
  int pos = find(d, d + n, e2) - d;
  if (pos == n)
    cout << "NO";
  else
    cout << "YES\n" << pos + 1;
}
