#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool isEqualBfs(vector<set<int>> &graph, queue<int> &bfs) {
  if (bfs.front() != 0) return false;
  int n = graph.size();
  queue<int> q;
  q.push(0);
  bfs.pop();
  while (!q.empty()) {
    int curr = q.front();
    q.pop();
    set<int> &s = graph[curr];
    while (s.size() > 0) {
      int front = bfs.front();
      if (s.find(front) == s.end()) return false;
      q.push(front);
      s.erase(front);
      graph[front].erase(curr);
      bfs.pop();
    }
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  vector<set<int>> graph(n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    graph[u].insert(v);
    graph[v].insert(u);
  }
  queue<int> bfs;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    num--;
    bfs.push(num);
  }
  bool ans = isEqualBfs(graph, bfs);
  if (ans)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
