#include <bits/stdc++.h>

int T;
int Teval;
std::vector<bool> recvisit;


void smash(std::vector<int> &add, std::vector<int> &data)
{
    for (size_t i = 0; i < data.size(); i++)
    {
        data[i]+=add[i];
    }
}

int eval(std::vector<int> &distance, std::vector<int> &data)
{
    int res=0;
    for (size_t i = 0; i < data.size(); i++)
    {
        res+=data[i]*distance[i];
    }
    return res;
}

void bfs(std::vector<int> &distance,std::vector<std::vector<int>> &tree,int n,int maxi)
{
    std::queue<int> q;
    std::vector<bool> visited(n,false);
    distance.assign(n, 0);
    q.push(maxi);
    visited[maxi]=true;
    while (!q.empty())
    {
        int u=q.front();
        q.pop();

        for (auto i:tree[u])
        {
            if (!visited[i])
            {
                visited[i]=true;
                distance[i]=distance[u]+1;

                q.push(i);
            }
        }
    }
}

void rec(std::vector<int> &distance,std::vector<int> &data,std::vector<std::vector<int>> &tree,int n,int maxi)
{
    if(eval(distance,data)>Teval) return;
    if(recvisit[maxi]) return;
    recvisit[maxi]==true;
    for(auto i:tree[maxi])
        {
            bfs(distance,tree,n,i);
            if(eval(distance,data)<Teval)
            {
                Teval=eval(distance,data);
                T=i;
                rec(distance,data,tree,n,i);
            }
            
        }
}


int main()
{
    int n;
    std::cin>>n;

    std::vector<std::vector<int>> tree(n);

    for (size_t i = 0; i < n; i++)
    {
        std::vector<int> tmp;
        tree.push_back(tmp);    
    }
    
    for (size_t i = 0; i < n-1; i++)
    {
        std::vector<int> tmp;
        int a,b;
        std::cin>>a>>b;
        a--;b--;
        tree[a].push_back(b);
        tree[b].push_back(a);    
    }

    std::vector<int> add;
    std::vector<int> data(n,0);
    std::vector<int> distance(n,0);
    
    int maxi=0;
    int max=0;

    for (size_t i = 0; i < n; i++)
    {
        int a; //val to add nod
        std::cin>>a;
        if(a>max) {
            max=a; 
            maxi=i;
        }

        add.push_back(a);
    }

    smash(add,data);
    distance.assign(n, 0);
    bfs(distance,tree,n,maxi);
    
    T=maxi;
    Teval=eval(distance,data);

    recvisit.assign(n, false);

    rec(distance,data,tree,n,maxi);

    int q;
    std::cin>>q;

    std::cout<<T++<<"\n";

    for (size_t i = 0; i < q; i++)
    {
        int d,b;
        std::cin>>d>>b;
        b--;
        data[b]+=d;
        if(data[b]>max)
        {
            max=data[b]; 
            maxi=b;
            bfs(distance,tree,n,maxi);
            T=maxi;
            Teval=eval(distance,data);

            recvisit.assign(n, false);
            rec(distance,data,tree,n,maxi);
        }
        

        std::cout<<T++<<"\n";
    }

    return 0;
}