#include <bits/stdc++.h>
using namespace std;
vector<int> check;
map<int, bool>* edge;
int n;
void input() {
  cin >> n;
  int u, v;
  edge = new map<int, bool>[n + 1];
  for (int i = 0; ++i < n;) {
    cin >> u >> v;
    edge[u][v] = 1, edge[v][u] = 1;
  }
  for (int i = ~0; ++i < n;) {
    cin >> u;
    check.emplace_back(u);
  }
}
void test() {
  int v = 1;
  for (int u = 0; u < check.size(); u++) {
    while (edge[check[u]][check[v]]) v++;
  }
  if (v == n && *check.begin() == 1)
    cout << "Yes";
  else
    cout << "No";
}
int main() {
  input();
  test();
}
