#include <bits/stdc++.h>
using namespace std;
int n, order[200005], relorder[200005];
vector<int> adj[200005];
bool v[200005];
bool mycomp(int a, int b) { return relorder[a] < relorder[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 0, j, k; i < n - 1; ++i) {
    scanf("%d %d", &j, &k);
    adj[j].push_back(k);
    adj[k].push_back(j);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", order + i);
    relorder[order[i]] = i;
  }
  for (int i = 1; i <= n; ++i) sort(adj[i].begin(), adj[i].end(), mycomp);
  queue<int> q;
  q.push(1);
  q.push(-1);
  int i = 0;
  while (!q.empty()) {
    bool f = 0;
    while (q.front() != -1) {
      f = 1;
      int x = q.front();
      v[x] = 1;
      if (x != order[i]) {
        printf("NO");
        return 0;
      }
      q.pop();
      i++;
      for (int j = 0; j < adj[x].size(); ++j)
        if (!v[adj[x][j]]) q.push(adj[x][j]);
    }
    if (f) q.push(-1);
    q.pop();
  }
  printf("YES");
  return 0;
}
