#include <bits/stdc++.h>
using namespace std;
int a[100009], b[100009], c[100009], d[100009];
int main() {
  int n = 0;
  cin >> n;
  int ans = 0;
  int qwe = -1;
  for (int i = 1; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    if (c[a[i]] != c[b[i]]) {
      ans++;
      d[a[i]]++;
      d[b[i]]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (ans == d[i]) {
      qwe = i;
      break;
    }
  }
  if (qwe == -1) {
    cout << "NO";
  } else {
    cout << "YES" << endl;
    cout << qwe;
  }
}
