#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
const int inf = INT_MAX >> 1;
int n;
vector<int> G[maxn];
int match[maxn];
int ans[maxn];
int vis[maxn];
int Rank[maxn];
void bfs() {
  memset(vis, 0, sizeof(vis));
  queue<int> que;
  while (que.size()) que.pop();
  que.push(1);
  int k = 1;
  while (que.size()) {
    int now = que.front();
    vis[now] = 1;
    ans[k++] = now;
    que.pop();
    int Size = G[now].size();
    for (int i = 0; i < Size; i++) {
      if (vis[G[now][i]] == 0) que.push(G[now][i]);
    }
  }
}
bool cmp(int a, int b) { return Rank[a] < Rank[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) G[i].clear();
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &match[i]);
    Rank[match[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    sort(G[i].begin(), G[i].end(), cmp);
  }
  bfs();
  int flag = 1;
  for (int i = 1; i <= n; i++) {
    if (match[i] != ans[i]) {
      flag = 0;
      break;
    }
  }
  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
}
