#include <bits/stdc++.h>
using namespace std;

#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define inf INT_MAX
#define llinf LLONG_MAX
#define mt make_tuple
#define mp make_pair
#define parll pair<ll,ll>
#define parii pair<int,int>
#define frs first
#define sec second
#define neparno(x) (x&1)
#define parno(x) (!neparno(x))
#define lowbit(x) (x&-x)
#define nzd __gcd
#define nzs(e1,e2) (e1/nzd(e1,e2))*e2
#define all(V) V.begin(),V.end()
#define fill(V,v) fill(all(V),v)
#define l_b(BRL,brl) lower_bound( BRL.begin(), BRL.end(), brl )-BRL.begin()-1
#define u_b(BRU,bru) upper_bound( BRU.begin(), BRU.end(), bru )-BRU.begin()
#define mxn 200004

struct grana
{
    ll v;
    ll l;
    ll d;
};

ll n,q,m,a,b,A[mxn],P[mxn],B[mxn],suma,posl,rez;
vector <grana> G[mxn];
vector <bool> V(mxn,false);
vector <ll> R;

void DFS1( ll i )
{
    V[i] = true;
    P[i] += A[i];
    for ( ll j = 0; j < G[i].size(); j++ )
    {
        ll next = G[i][j].v;
        if ( !V[next] )
        {
            DFS1(next);
            P[i] += P[next];
            G[i][j].d = P[next];
            G[i][j].l = suma-G[i][j].d;
        }
    }
}

void DFS2( ll i )
{
    V[i] = true;
    posl = i;
    for ( ll j = 0; j < G[i].size(); j++ )
    {
        ll next = G[i][j].v;
        ll l = G[i][j].l; ll d = G[i][j].d;
        if ( !V[next] && (d > l || (d == l && next < i)) )
        {
            rez = d-l;
            DFS2(next);
        }
    }
}

void Usmeravanje()
{
    DFS1(1);
    fill(V,false);
    DFS2(1);
    cout << posl;
}

bool cmp( grana a, grana b )
{
    return (a.v>b.v);
}

void DFS3( ll i, ll b )
{
    V[i] = true;
    B[i] = b;
    b = 2*b;
    for ( auto x : G[i] )
    {
        ll next = x.v;
        if ( !V[next] )
        {
            DFS3(next,b);
            b++;
        }
    }
}

void DFS4( ll i )
{
    V[B[i]] = true;
    P[B[i]] += A[i];
    for ( ll j = 0; j < G[i].size(); j++ )
    {
        ll next = G[i][j].v;
        if ( !V[next] )
        {
            DFS4(next);
            P[B[i]] += P[B[next]];
            G[i][j].d = P[B[next]];
            G[i][j].l = suma-G[i][j].d;
        }
    }
}

void DFS5( ll i, ll x )
{
    V[B[i]] = true;
    A[i] += x;
    P[B[i]] += x;
    for ( ll j = 0; j < G[i].size(); j++ )
    {
        ll next = G[i][j].v;
        ll l = G[i][j].l; ll d = G[i][j].d;
        if ( abs(d-l) < rez )
        {
            rez = abs(d-l);
            posl = next;
        }
        if ( !V[next] && B[next] < B[i] )
        {
            DFS5(next,x);
        }
    }
}

void Binarno( ll root )
{
    ll a,b;
    DFS3(root,1);
    fill(V,false);
    DFS4(root);
    fill(V,false);
    DFS2(root);
    fill(V,false);
    cout << posl << "\n";
    while ( q-- )
    {
        cin >> a >> b;
        suma += a;
        DFS5(b,a);
        fill(V,false);
        cout << posl << "\n";
    }
}

int main()
{
    ios;

    cin >> n;
    ll u,v;
    ll br1=0,br2=0,br3=0,root;
    for ( ll i = 1; i < n; i++ )
    {
        cin >> u >> v;
        G[u].push_back({v,0,0});
        G[v].push_back({u,0,0});
    }
    for ( ll i = 1; i <= n; i++ )
    {
        sort(all(G[i]),cmp);
    }
    for ( ll i = 1; i <= n; i++ )
    {
        cin >> A[i];
        suma += A[i];
    }
    cin >> q;
    if ( q == 0 )
    {
        Usmeravanje();
        return 0;
    }
    for ( ll i = 1; i <= n; i++ )
    {
        br1 += (G[i].size()==1);
        br3 += (G[i].size()==3);
        if ( G[i].size() == 2 )
        {
            br2++;
            root = i;
        }
    }
    if ( br2 == 1 && br1 == n/2 && br3 == n-n/2-1 )
    {
        Binarno(root);
        return 0;
    }
    while ( q-- )
    {
        cin >> a >> b;
        cout << "1\n";
    }

    return 0;
}