#include <bits/stdc++.h>
using namespace std;
int n, a[200005];
map<int, int> son[200005];
int id, s[200005], toit[2 * 200005], nxt[2 * 200005];
int num[200005];
int q[200005], now, p[200005];
void add(int aa, int bb) {
  id++;
  toit[id] = bb;
  nxt[id] = s[aa];
  s[aa] = id;
}
void dfs(int x, int fa) {
  for (int i = s[x]; i; i = nxt[i]) {
    int y = toit[i];
    if (y == fa) continue;
    son[x][y] = 1;
    dfs(y, x);
    num[x]++;
  }
}
int check() {
  int head = 1;
  int tail = 0;
  q[1] = 1;
  now = 1;
  while (tail < head) {
    tail++;
    int nowx = q[tail];
    for (int i = now + 1; i <= now + num[nowx]; i++) {
      head++;
      q[head] = a[i];
      if (son[nowx][a[i]] == 0) return 0;
    }
    now = now + num[nowx];
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    add(x, y);
    add(y, x);
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dfs(1, 0);
  if (check())
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
