#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
struct node {
  int v, nxt;
} e[N * 2];
int head[N], ejs;
void add(int u, int v) {
  e[++ejs].v = v;
  e[ejs].nxt = head[u];
  head[u] = ejs;
}
int a[N], fa[N];
int dep[N], vis[N];
queue<int> q;
inline void bfs(int u) {
  dep[u] = 0;
  q.push(u);
  vis[u] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = e[i].nxt) {
      int v = e[i].v;
      if (vis[v]) continue;
      dep[v] = dep[u] + 1;
      vis[v] = 1;
      fa[v] = u;
      q.push(v);
    }
  }
}
int pos[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    pos[a[i]] = i;
  }
  bfs(1);
  int now = 0, fanow = 0;
  for (int i = 1; i <= n; ++i) {
    if (dep[a[i]] < now || pos[fa[a[i]]] < fanow) {
      printf("NO\n");
      return 0;
    }
    if (dep[a[i]] > now) now = dep[a[i]];
    fanow = pos[fa[a[i]]];
  }
  printf("YES\n");
  return 0;
}
