/**
 * created by : Mostafa Wael (Phoenix)
 * problem name : Valid BFS 
 */
#include <bits/stdc++.h>
using namespace std;

void make_edge(int &u, int &v, vector<vector<int>>&tree)
{
    tree[u].push_back(v);
    tree[v].push_back(u);
}

bool check_path_isCorrect(int source, int &n, vector<vector<int>> &tree, vector<bool> &isVisited, queue<int> &path)
{
    if(source!=path.front()) 
        return false;
    path.pop();
    queue<int> q;
    q.push(source);
    isVisited[source]=true;
    while (!q.empty()){
        int u=q.front(); q.pop();
        int sz=tree[u].size()+(u==source); // first node has no parent 
        while(--sz){
            isVisited[path.front()]=true;
            q.push(path.front());
            path.pop();
        }
        for(auto v:tree[u])
            if(!isVisited[v])
                return false;
    }
    return true;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /**
     * we can use path to mark node and then check for neighbors node if visited or no 
     */
    int n;
    cin >> n;
    vector<vector<int>> tree(n);
    for (int i = 1; i < n; i++)
    {
        int u, v;
        cin >> u >> v;
        make_edge(--u, --v, tree);
    }
    queue<int> path;
    for(int i=0,u;i<n;i++){
        cin>>u;
        path.push(--u);
    }
    vector<bool> isVisited(n);
    cout << (check_path_isCorrect(0, n, tree, isVisited, path) ? "Yes" : "No");
    return 0;
}
