#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int n;
ll sum;

ll niz[200005];
ll seg[4*200005];
int ko[200005];
void init(int node, int l, int r){
    if(l == r){
        seg[node] = niz[ko[l]];
        return;
    }
    int mid = (l + r) / 2;
    init(node * 2, l, mid);
    init(node * 2 + 1, mid + 1, r);
    seg[node] = seg[node * 2] + seg[node * 2 + 1];
}
void update(int node, int l, int r, int poz, ll val){
    if(l == r){seg[node] += val; return;}
    int mid = (l + r) / 2;
    if(poz <= mid)update(node*2,l,mid,poz,val);
    else update(node*2+1,mid+1,r,poz,val);
    seg[node] = seg[node*2] + seg[node*2+1];
}
ll query(int node, int l, int r, int levo, int desno){
    if(r < levo || l > desno)return 0;
    if(l >= levo && r <= desno)return seg[node];
    int mid = (l+r)/2;
    return query(node*2,l,mid,levo,desno)+query(node*2+1,mid+1,r,levo,desno);
}

vector<int> graf[200005];
int cale[200005][21];
int disc[200005];

int out[200005];
int br=1;

void dfs(int x, int y){
    cale[x][0] = y;
    ff(j,1,20)cale[x][j] = cale[cale[x][j-1]][j-1];
    disc[x] = br;
    ko[disc[x]] = x;
    for(auto c:graf[x]){
        if(c == y)continue;
        br++;
        dfs(c,x);
    }
    out[x] = br;
}
bool usabu(int x, int y){
    if(x == 0)return 1;
    if(disc[y] >= disc[x] && disc[y] <= out[x])return 1;
    return 0;
} /// y u x

int nadjicentroid(int x){
    for(auto c:graf[x]){
        if(c == cale[x][0])continue;
        ll sta = query(1,1,n,disc[c],out[c]);
        if(2*sta==sum)return min(x,c);
        if(2*sta>sum)return nadjicentroid(c);
    }
    return x;
}

int lca(int x, int y){
    if(usabu(x,y))return x;
    if(usabu(y,x))return y;
    fb(j,20,0){
        if(!usabu(cale[x][j],y))x = cale[x][j];
    }
    return cale[x][0];
}

bool dobar(int x){
    ll sta = query(1,1,n,disc[x],out[x]);
    if(2*sta<sum)return 1;
    return 0;
}

int resi(int x, int y){
    if(x == y)return x;
    if(!dobar(x))return x;
    fb(j,20,0){
        if(!usabu(y,cale[x][j]))continue;
        if(dobar(cale[x][j]))x=cale[x][j];
    }
    return cale[x][0];

}

int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    ff(i,1,n-1){
        int x,y;
        cin >> x >> y;
        graf[x].pb(y);
        graf[y].pb(x);
    }
    dfs(1,0);
    ff(i,1,n){cin >> niz[i]; sum += niz[i];}
    init(1,1,n);

    int odg = nadjicentroid(1);
    cout << odg << "\n";

    int q;
    cin >> q;
    while(q--){
        ll x;
        int y;
        cin >> x >> y;
        update(1,1,n,disc[y],x);
        sum += x;

        int sta = lca(odg,y);

        int p1 = resi(odg,sta);
        int p2 = resi(y,sta);
        if(p1 == sta)p1 = p2;
        if(p1 == 1)cout << p1 << "\n";
        else{
             ll pom = query(1,1,n,disc[p1],out[p1]);
             if(2*pom == sum)p1 = min(p1,cale[p1][0]);
             cout << p1 << "\n";
        }
        odg = p1;



    }

    return 0;
}