#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const int mod = 1e9 + 7;
const int si[8] = {-1, -1, 0, +1, +1, +1, 0, -1};
const int sj[8] = {0, +1, +1, +1, 0, -1, -1, -1};
int n;
vector<vector<int> > g;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n;
  vector<int> a(n), x(n - 1), y(n - 1), u(n, 0);
  g.resize(n);
  int nn = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> x[i] >> y[i];
    x[i]--, y[i]--;
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++)
    if (a[x[i]] != a[y[i]]) {
      g[x[i]].push_back(y[i]);
      g[y[i]].push_back(x[i]);
      if (!u[x[i]]) u[x[i]] = 1, nn++;
      if (!u[y[i]]) u[y[i]] = 1, nn++;
    }
  for (int i = 0; i < n; i++)
    if (g[i].size() == nn - 1 || nn == 0) {
      cout << "YES\n";
      cout << i + 1 << "\n";
      return 0;
    }
  cout << "NO\n";
  return 0;
}
