#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const int N = 2500005;
inline int read() {
  int x = 0, k = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * k;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int vis[300005];
int a[300005];
vector<int> g[300005];
int P[300005];
int pre[300005];
void dfs(int x, int fa) {
  pre[x] = fa;
  for (int i = 0; i < g[x].size(); i++) {
    if (g[x][i] == fa) continue;
    dfs(g[x][i], x);
  }
}
int main() {
  int n;
  n = read();
  int i, j;
  for (i = 0; i < n - 1; i++) {
    int u, v;
    u = read();
    v = read();
    g[u].push_back(v);
    g[v].push_back(u);
  }
  pre[1] = 0;
  vis[0] = 1;
  dfs(1, 0);
  for (i = 1; i <= n; i++) a[i] = read();
  if (a[1] != 1) {
    cout << "NO" << endl;
    return 0;
  }
  vis[1] = 1;
  P[1] = 1;
  for (i = 2; i <= n; i++) {
    if (!vis[pre[a[i]]]) {
      cout << "NO" << endl;
      return 0;
    }
    vis[a[i]] = 1;
    P[a[i]] = i;
    if (P[pre[a[i]]] >= P[pre[a[i - 1]]])
      continue;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
