#include <bits/stdc++.h>
using namespace std;
vector<int> v[200010];
int vis[200010] = {0};
int a[200010];
int fa[200010];
int num[200010];
int main() {
  int n, i, x, y;
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) fa[i] = i;
  queue<int> q;
  q.push(a[0]);
  while (!q.empty()) {
    int p = q.front();
    q.pop();
    if (vis[p] == 1) continue;
    vis[p] = 1;
    for (i = 0; i < v[p].size(); i++) {
      if (!vis[v[p][i]]) {
        q.push(v[p][i]);
        fa[v[p][i]] = p;
      }
    }
  }
  int last = 0, fl = 0;
  for (i = 0; i < n; i++) {
    num[a[i]] = i;
    if (i) {
      int cc = num[fa[a[i]]];
      if (cc < last || fa[a[i]] == a[i]) {
        fl = 1;
        break;
      }
      last = cc;
    }
  }
  if (fl == 1 || a[0] != 1)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}
