#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
vector<int> g[maxn];
int pos[maxn];
bool cmp(int a, int b) { return pos[a] < pos[b]; }
bool vis[maxn];
int b[maxn];
void bfs() {
  int cnt = 0;
  queue<int> q;
  q.push(1);
  vis[1] = true;
  b[++cnt] = 1;
  while (q.size()) {
    int p = q.front();
    q.pop();
    for (int i = 0; i < g[p].size(); i++) {
      int to = g[p][i];
      if (!vis[to]) {
        q.push(to);
        vis[to] = true;
        b[++cnt] = to;
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  int tmp = n - 1;
  while (tmp--) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int a[maxn];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    sort(g[i].begin(), g[i].end(), cmp);
  }
  bfs();
  for (int i = 1; i <= n; i++) {
    if (a[i] != b[i]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
