#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
vector<vector<long long>> adj;
vector<long long> color;
long long current_color;
bool ok = true;
void dfs(long long v, long long parent) {
  ok = ok && (current_color == color[v]);
  for (auto u : adj[v]) {
    if (u != parent) {
      dfs(u, v);
    }
  }
}
bool solve(long long v) {
  bool ans = true;
  for (auto u : adj[v]) {
    ok = true;
    current_color = color[u];
    dfs(u, v);
    ans = ans & ok;
  }
  return ans;
}
void solve() {
  long long n;
  cin >> n;
  adj.clear();
  adj.resize(n);
  for (long long i = 0; i <= n - 2; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  color.clear();
  color.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> color[i];
  }
  long long root1 = -1;
  long long root2 = -1;
  for (long long i = 0; i < n; i++) {
    for (auto u : adj[i]) {
      if (color[i] != color[u]) {
        root1 = i;
        root2 = u;
        break;
      }
    }
  }
  if (root1 == -1) {
    cout << "YES" << endl;
    cout << 1 << endl;
    return;
  }
  bool ans1 = solve(root1);
  bool ans2 = solve(root2);
  if (ans1) {
    cout << "YES" << endl;
    cout << root1 + 1 << endl;
    return;
  }
  if (ans2) {
    cout << "YES" << endl;
    cout << root2 + 1 << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}
int32_t main() {
  solve();
  return 0;
}
