#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> bfs(int cur, vector<bool>& visited, vector<int> adj[]) {
  queue<int> q;
  q.push(cur);
  vector<int> ans;
  while (!q.empty()) {
    int tp = q.front();
    q.pop();
    ans.push_back(tp);
    visited[tp] = true;
    for (int node : adj[tp]) {
      if (!visited[node]) q.push(node);
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> adj[n + 1];
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  vector<int> bfs_given(n);
  unordered_map<int, int> bfs_index;
  for (int i = 0; i < n; ++i) {
    cin >> bfs_given[i];
    bfs_index[bfs_given[i]] = i;
  }
  auto compare = [&](int i, int j) { return bfs_index[i] < bfs_index[j]; };
  for (int i = 1; i <= n; i++) {
    sort(adj[i].begin(), adj[i].end(), compare);
  }
  vector<bool> visited(n + 1, false);
  vector<int> bfs_calc = bfs(1, visited, adj);
  bool ans = (bfs_calc == bfs_given);
  cout << (ans ? "YES" : "NO") << endl;
  return 0;
}
