#include <bits/stdc++.h>
using namespace std;
vector<long long> ed[200005];
map<long long, map<long long, bool> > exist;
long long info[200005];
bool BFS(long long s, long long noof) {
  bool vis[200005];
  memset(vis, false, sizeof vis);
  queue<long long> Q;
  Q.push(s);
  vis[s] = true;
  long long k = 1;
  if (info[k] != 1) {
    return false;
  }
  k++;
  while (!Q.empty()) {
    long long u = Q.front();
    Q.pop();
    long long x = ed[u].size() - 1, y = 1;
    if (u == 1) x++, y--;
    long long n = ed[u].size(), i, cnt1 = 0, cnt2 = 0;
    for (i = k; i <= noof; i++) {
      if (!exist[u][info[i]]) {
        k = i;
        break;
      }
      if (vis[info[i]]) {
        cnt2++;
      } else {
        vis[info[i]] = true;
        Q.push(info[i]), cnt1++;
      }
      if (u == 1) {
        if (cnt1 == x) {
          k = i + 1;
          break;
        }
      } else if (cnt1 == x and cnt2 >= y) {
        k = i + 1;
        break;
      }
    }
    if (cnt1 != x or cnt2 > y) {
      return false;
    }
  }
  return true;
}
int main() {
  long long n, m, t, i, j, k, a, b, c, cs = 1;
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    exist[a][b] = exist[b][a] = true;
    ed[a].push_back(b);
    ed[b].push_back(a);
  }
  for (i = 1; i <= n; i++) cin >> info[i];
  if (BFS(1, n) or n == 1)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
