#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
int n;
int d[300300], u[300300], cnt[300300], w[300300], p[300300];
vector<int> g[300300], L[300300];
void dfs(int v, int pa) {
  p[v] = pa;
  for (int to : g[v])
    if (to != pa) dfs(to, v);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(1, 0);
  u[1] = 1;
  for (int i = 2; i <= n; ++i) d[i] = inf;
  queue<int> q;
  q.push(1);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int to : g[v]) {
      if (!u[to]) {
        u[to] = 1;
        q.push(to);
        d[to] = d[v] + 1;
      }
    }
  }
  for (int i = 1; i <= n; ++i) cnt[d[i]]++;
  int pos = 1;
  for (int i = 1; i <= n; ++i) cin >> w[i];
  for (int z = 0; z <= n; ++z) {
    if (!cnt[z]) continue;
    for (int j = pos; j <= cnt[z] + pos - 1; ++j) {
      L[z].push_back(w[j]);
      if (d[w[j]] != z) {
        cout << "No\n";
        return 0;
      }
    }
    vector<int> v, v2, v3;
    map<int, bool> used;
    for (int j = pos; j <= cnt[z] + pos - 1; ++j) v.push_back(p[w[j]]);
    used[v[0]] = 1;
    for (int i = 1; i < v.size(); ++i) {
      if (v[i] != v[i - 1] && used[v[i]]) {
        cout << "No\n";
        return 0;
      }
      used[v[i]] = 1;
    }
    if (z > 0) {
      v2.push_back(v[0]);
      for (int i = 1; i < v.size(); ++i)
        if (v[i] != v[i - 1]) v2.push_back(v[i]);
      for (int b : L[z - 1])
        if (used[b]) v3.push_back(b);
      if (v2 != v3) {
        cout << "No\n";
        return 0;
      }
    }
    pos = cnt[z] + pos;
  }
  cout << "Yes\n";
  return 0;
}
