#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long int INF = 9e18 + 2e17;
const int inf = 2e9;
const int N = 1e3 + 22;
const double eps = 1e-10;
const double PI = 3.14159265;
int n, x, y, c[100005], u[100005], v[100005], m = 0, f[100005];
void solve() {
  cin >> n;
  for (int i = 1; i < n; i++) cin >> u[i] >> v[i];
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i < n; i++)
    if (c[u[i]] != c[v[i]]) m++, f[v[i]]++, f[u[i]]++;
  for (int i = 1; i <= n; i++) {
    if (f[i] == m) {
      cout << "YES" << '\n' << i;
      return;
    }
  }
  cout << "NO";
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
