#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
vector<int> g[N];
bool is[N];
int cnt[N], c[N], sum;
void dfs(int v) {
  is[v] = true;
  for (auto to : g[v]) {
    if (!is[to]) {
      if (c[v] != c[to]) {
        cnt[v]++;
        cnt[to]++;
        sum++;
      }
      dfs(to);
    }
  }
}
void no() {
  cout << "NO";
  exit(0);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) cin >> c[i];
  dfs(1);
  int ans = -1;
  for (int i = 1; i <= n; i++) {
    if (sum == cnt[i]) {
      ans = i;
    }
  }
  if (ans == -1) no();
  cout << "YES" << endl << ans;
}
