#include <bits/stdc++.h>
using namespace std;
int n;
int ar[300111];
vector<int> v[300111];
int con[300111];
int ans = 0;
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) cin >> ar[i];
  int hue = 0;
  for (int i = 1; i <= n; i++)
    for (int k : v[i]) {
      if (ar[k] != ar[i]) {
        hue++;
        con[k]++;
        con[i]++;
      }
    }
  for (int i = 1; i <= n; i++)
    if (con[i] == hue) {
      cout << "YES"
           << "\n"
           << i << "\n";
      return 0;
    }
  cout << "NO"
       << "\n";
}
