#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > tree((int)1e6);
int path[(int)1e6];
int n, x, y;
bool bfs(int start) {
  queue<int> q;
  q.push(start);
  bool flag[(int)1e6] = {0};
  int idx = 0, nxt = 1;
  while (q.size()) {
    int curr = q.front();
    q.pop();
    if (curr != path[idx++]) return 0;
    while (nxt < n &&
           binary_search(tree[curr].begin(), tree[curr].end(), path[nxt])) {
      if (!flag[path[nxt]]) {
        flag[path[nxt]] = true;
        q.push(path[nxt]);
      }
      nxt++;
    }
  }
  if (idx != n) return 0;
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d", &x, &y);
    tree[x].push_back(y);
    tree[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    sort(tree[i + 1].begin(), tree[i + 1].end());
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &path[i]);
  }
  if (path[0] == 1 && bfs(path[0]) == 1)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
