#include <bits/stdc++.h>
using namespace std;
int x[100001], y[100001], c[100001], d[100001];
int main() {
  int n, i;
  cin >> n;
  for (i = 1; i <= n - 1; i++) {
    cin >> x[i] >> y[i];
  }
  for (i = 1; i <= n; i++) {
    cin >> c[i];
  }
  int t = 0;
  for (i = 1; i <= n; i++) {
    if (c[x[i]] != c[y[i]]) {
      t++;
      d[x[i]]++;
      d[y[i]]++;
    }
  }
  for (i = 1; i <= n; i++) {
    if (d[i] == t) {
      cout << "YES\n";
      cout << i;
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
