#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 2e9;
int main() {
  int n;
  cin >> n;
  vector<int> u(n), v(n);
  vector<vector<int>> g(n);
  for (int i = 0; i < (n - 1); i++) {
    cin >> u[i] >> v[i];
    u[i]--;
    v[i]--;
    g[u[i]].emplace_back(v[i]);
    g[v[i]].emplace_back(u[i]);
  }
  vector<int> c(n);
  for (int i = 0; i < (n); i++) cin >> c[i];
  int cnt = 0;
  for (int i = 0; i < n - 1; i++) cnt += (c[u[i]] != c[v[i]]);
  for (int i = 0; i < n; i++) {
    int x = 0;
    for (auto e : g[i])
      if (c[i] != c[e]) x++;
    if (x == cnt) {
      cout << "YES" << endl;
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
