#include <bits/stdc++.h>
using namespace std;
long long t = 1;
void solve() {
  long long n, x, y;
  cin >> n;
  vector<long long> col(n + 1, 0), vv(n + 1);
  vector<vector<long long> > v(n + 1);
  for (int i = 1; i < n; i += 1) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i < n + 1; i += 1) {
    cin >> col[i];
  }
  x = 0;
  for (int i = 1; i < n + 1; i += 1) {
    for (int j = 0; j < int((v[i]).size()); j += 1) {
      if (col[v[i][j]] != col[i]) {
        x++;
        vv[v[i][j]]++;
        vv[i]++;
      }
    }
  }
  for (int i = 1; i < n + 1; i += 1) {
    if (x == vv[i]) {
      cout << "YES\n" << i;
      return;
    }
  }
  cout << "NO";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (t--) solve();
  return 0;
}
