#include <bits/stdc++.h>
using namespace std;
long long A[1000007], P[1000007], T[1000007];
bool S[1000007];
vector<long long> V[1000007];
queue<long long> Q;
int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    V[a].push_back(b);
    V[b].push_back(a);
  }
  Q.push(1);
  S[1] = true;
  while (!Q.empty()) {
    int ind = Q.front();
    Q.pop();
    for (int i = 0; i < V[ind].size(); i++)
      if (!S[V[ind][i]]) {
        Q.push(V[ind][i]);
        A[ind]++;
        P[V[ind][i]] = ind;
        S[V[ind][i]] = true;
      }
  }
  bool B = true;
  int c;
  cin >> c;
  if (c != 1)
    B = false;
  else
    Q.push(c);
  if (B)
    for (int i = 2; i <= N; i++) {
      cin >> c;
      while (A[Q.front()] == 0) Q.pop();
      if (P[c] == Q.front()) {
        Q.push(c);
        A[Q.front()]--;
      } else {
        B = false;
        break;
      }
    }
  if (B)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
}
