#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int N, xi, yi,minind;
    cin >> N;
    vector<int> graf[N];
    queue<int> red;
    unsigned long long int duzine[N] = {0}, min;
    
    for(int i = 0; i < N-1; i++){
        cin >> xi >> yi;
        graf[xi-1].push_back(yi-1);
        graf[yi-1].push_back(xi-1);
    }
    for(int i = 0; i < N; i++){
        cin >> xi;
        int br=1, brsled=1, koef=1, cvor;
        bool poseceni[N] = {false};
        red.push(i);
        while(!red.empty()){
            cvor = red.front();
            red.pop();
            poseceni[cvor] = true;
            br--;
            brsled--;
            for(int j = 0;j < graf[cvor].size();j++){
                if(poseceni[graf[cvor][j]]) continue;
                red.push(graf[cvor][j]);
                duzine[graf[cvor][j]] += xi*koef;
                brsled++;
            }
            if(br == 0){ br = brsled;koef++;}
        }
    }
    int q, zi, bi;
    cin >> q;
    for(int i = 0; i <= q; i++)
    {
        if(i == 0){
            min = duzine[0];minind = 0;
            for(int j = 0; j < N; j++){
                if(duzine[j] < min){
                    min = duzine[j];minind = j;
                }
            }
            cout << minind+1 << "\n";
            continue;
        }
        cin >> zi >> bi;
        ////////////////////////////
        int br=1, brsled=1, koef=1, cvor;
        bool poseceni[N] = {false};
        red.push(bi-1);
        min = duzine[bi-1];
        minind = bi-1;
        while(!red.empty()){
            cvor = red.front();
            red.pop();
            poseceni[cvor] = true;
            br--;
            brsled--;
            for(int j = 0;j < graf[cvor].size();j++){
                if(poseceni[graf[cvor][j]]) continue;
                red.push(graf[cvor][j]);
                duzine[graf[cvor][j]] += zi*koef;
                if(duzine[graf[cvor][j]]< min){
                    min = duzine[graf[cvor][j]];minind=graf[cvor][j];
                }
                brsled++;
            }
            if(br == 0){ br = brsled;koef++;}
        }
        ////////////////
        cout << minind+1 << "\n";
    }
    
    
    return 0;
}