#include <bits/stdc++.h>
using namespace std;
const int N = 2000 * 100 + 3;
vector<int> adj[N];
int n, a[N], b[N], c[N];
bool mark[N], adjOne[N];
bool cmp(int x, int y) { return a[x] < a[y]; }
void input() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    --v, --u;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    int u;
    cin >> u;
    u--;
    c[i] = u;
    a[u] = i;
  }
}
void bfs() {
  int id = 0;
  queue<int> q;
  q.push(0);
  mark[0] = true;
  while (!q.empty()) {
    int u = q.front();
    b[id] = u;
    id++, q.pop();
    for (auto v : adj[u])
      if (!mark[v]) {
        mark[v] = true;
        q.push(v);
      }
  }
}
void solve() {
  for (int i = 0; i < n; i++) sort(adj[i].begin(), adj[i].end(), cmp);
  bfs();
  for (int i = 0; i < n; i++)
    if (c[i] != b[i]) cout << "No\n", exit(0);
  cout << "Yes\n";
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  input(), solve();
  return 0;
}
