#include<bits/stdc++.h>
#define ll long long
#define MAXN 200007
using namespace std;
vector<vector<ll>>T(MAXN);
ll a[MAXN];
ll cost1[MAXN]={};
ll prefix1[MAXN]={};
bool visited[MAXN]={};
void cost(ll node)
{
    prefix1[node]=a[node];
    visited[node]=true;
    for(auto i:T[node])
    {
        if(!visited[i])
        {
            cost(i);
            prefix1[node]+=prefix1[i];
            cost1[node]+=cost1[i]+prefix1[i];
        }
    }
    return;
}
ll mini=1;
void findmin(ll node)
{
    for(auto i:T[node])
    {
        ll tempCR=cost1[node]-cost1[i]-prefix1[i];
        ll tempPR=prefix1[node]-prefix1[i];
        ll c1=cost1[i]+tempCR+tempPR;
        if(c1<cost1[node] || (c1==cost1[node]&&i<mini))
        {
            mini=i;
            prefix1[node]=tempPR;
            cost1[node]=tempCR;
            cost1[i]=c1;
            prefix1[i]+=tempPR;
            findmin(i);
        }
    }
    return;
}
void solve1(ll n)
{
    cost(1);
    findmin(1);
    cout<<mini<<endl;
    return;
}



map<ll,ll>org;
ll posi[MAXN];
ll sums[MAXN], sump[MAXN];
void dfs(ll node, ll p)
{
    visited[node]=true;
    org[p]=node;
    posi[node]=p;
    ll k=2*p;
    for(auto i:T[node])
    {
        if(!visited[i]) dfs(i,k++);
    }
    return;
}
ll getVal(ll node, ll n)
{
    ll res=0;
    ll cnt=1;
    if(node<=n/2) res+=sums[node*2]+sums[node*2+1];
    while(node>1)
    {
        res+=sums[node^1];
        res+=(a[org[node/2]]+sump[node^1])*cnt;
        cnt++;
        node/=2;
    }
    return res;
}
ll cost2[MAXN];
void PerfetSolve(ll n, ll q)
{
    ll root=1;
    for(ll i=1;i<=n;i++)
    {
        if(T[i].size()==2) root=i;
    }
    for(ll i=0;i<=n;i++) visited[i]=false;
    dfs(root,1);
    for(ll i=(n+1)/2;i<=n;i++)
    {
        sums[i]=a[org[i]];
        sump[i]=a[org[i]];
    }
    for(ll i=(n-1)/2;i>0;i--)
    {
        sump[i]=sump[2*i]+sump[2*i+1]+a[org[i]];
        sums[i]=sums[2*i]+sums[2*i+1]+sump[i];
    }
    for(ll i=1;i<=n;i++) cost2[i]=getVal(i,n);
    mini=LLONG_MAX;
    ll mininode=1;
    for(ll i=1;i<=n;i++)
    {
        if(cost2[i]<mini)
        {
            mini=cost2[i];
            mininode=org[i];
        }
        else if(cost2[i]==mini) mininode=min(org[i],mininode);
    }
    cout<<mininode<<endl;
    while(q--)
    {
        ll val,pos;
        cin>>val>>pos;
        ll it=posi[pos];
        sump[it]+=val;
        sums[it]+=val;
        for(ll i=it/2;i>0;i--)
        {
            sump[i]=sump[2*i]+sump[2*i+1]+a[org[i]];
            sums[i]=sums[2*i]+sums[2*i+1]+sump[i];
        }
        ll it1=posi[pos];
        ll it2=posi[mininode];
        mini=getVal(it2,n);
        if(getVal(it1,n)<mini)
        {
            mini=getVal(it1,n);
            mininode=org[it1];
        }
        else if(getVal(it1,n)==mini) mininode=min(mininode,org[it1]);
        while(it1!=it2)
        {
            if(it2>it1)
            {
                it2/=2;
                if(getVal(it2,n)<mini)
                {
                    mini=getVal(it2,n);
                    mininode=org[it2];
                }
                else if(getVal(it2,n)==mini) mininode=min(mininode,org[it2]);
            }
            else
            {
                it1/=2;
                if(getVal(it1,n)<mini)
                {
                    mini=getVal(it1,n);
                    mininode=org[it1];
                }
                else if(getVal(it1,n)==mini) mininode=min(mininode,org[it1]);
            }
        }
        cout<<mininode<<endl;
    }
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    for(ll i=0;i<n-1;i++)
    {
        ll u,v;
        cin>>u>>v;
        T[u].push_back(v);
        T[v].push_back(u);
    }
    for(ll i=1;i<=n;i++) cin>>a[i];
    ll q;
    cin>>q;
    if(q==0)
    {
        solve1(n);
    }
    else PerfetSolve(n,q);
    return 0;
}