#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
vector<pair<int, int> > s;
int co[maxn], deg[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    pair<int, int> q;
    cin >> q.first >> q.second;
    s.push_back(q);
  }
  for (int i = 1; i <= n; i++) {
    cin >> co[i];
  }
  int x = 0;
  for (auto i : s) {
    if (co[i.first] != co[i.second]) {
      deg[i.first]++;
      deg[i.second]++;
      x++;
    }
  }
  int flag = 0;
  for (int i = 1; i <= n; i++) {
    if (deg[i] == x) {
      flag = i;
    }
  }
  if (flag) {
    printf("YES\n%d\n", flag);
  } else {
    printf("NO\n");
  }
}
