#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int n, i, u, v, z, q, max1, ind;
    cin >> n;
    vector<int> graf[n+1];
    vector<int> banke;
    for(i=0;i<n-1;i++)
    {
        cin >> u >> v;
        graf[u].push_back(v);
        graf[v].push_back(u);
    }
    max1=-1;
    ind=-1;
    for(i=0;i<n;i++)
    {
        cin >> z;
        banke.push_back(z);
        if(z>max1)
        {
            z=max1;
            ind = i+1;
        }
    }
    cin >> q;
    cout << ind << endl;
}