#include <bits/stdc++.h>
using namespace std;
set<int> arr[400000], brr[400000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  t = 1;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
      int x, y;
      cin >> x >> y;
      arr[x].insert(y);
      arr[y].insert(x);
    }
    int brr[n + 2];
    for (int i = 1; i <= n; i++) {
      cin >> brr[i];
    }
    queue<int> crr;
    crr.push(1);
    bool visit[400000] = {0};
    visit[1] = 1;
    arr[1].insert(0);
    int cnt = 1, flag = 0;
    while (!crr.empty()) {
      int k = crr.front();
      visit[k] = 1;
      crr.pop();
      for (int i = 0; i < arr[k].size() - 1; i++) {
        cnt++;
        if (arr[k].find(brr[cnt]) != arr[k].end()) {
          visit[brr[cnt]] = 1;
          crr.push(brr[cnt]);
        } else {
          cout << "NO\n";
          return 0;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      if (visit[i] == 0) {
        cout << "NO\n";
        return 0;
      }
    }
    cout << "YES\n";
    return 0;
  }
}
