#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<long long> v[N];
long long vis[N];
long long col[N];
set<long long> che;
void dfs(long long x) {
  vis[x] = 1;
  che.insert(x);
  for (auto it : v[x]) {
    if (!vis[it]) {
      dfs(it);
    }
  }
}
void solve() {
  long long n;
  cin >> n;
  long long i, x, y;
  vector<pair<long long, long long> > e, spe;
  for (i = 0; i < n - 1; i++) {
    cin >> x >> y;
    x--, y--;
    e.push_back(make_pair(x, y));
  }
  for (i = 0; i < n; i++) {
    cin >> col[i];
  }
  for (auto it : e) {
    if (col[it.first] != col[it.second]) {
      spe.push_back(make_pair(it.first, it.second));
    }
  }
  long long m = spe.size();
  long long f = 0, ind = 0;
  long long cnt[n];
  memset(cnt, 0, sizeof(cnt));
  if (m == 0) {
    cout << "YES\n1";
    return;
  }
  for (auto it : spe) {
    cnt[it.first]++;
    cnt[it.second]++;
  }
  for (i = 0; i < n; i++) {
    if (cnt[i] == m) {
      cout << "YES\n" << i + 1;
      return;
    }
  }
  cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
