#include <bits/stdc++.h>
#define MAXN 200010
#define F first
#define S second

using namespace std;

typedef long long ll;

vector<ll> adj[MAXN];
bool pos[MAXN];
ll a[MAXN];
ll n, x, y, q, dist, rez, minrez, minrezI;
pair<ll, ll> b[MAXN];

void dfs(int node)
{
    rez += a[node] * dist;
    dist++;
    pos[node] = true;
    for(auto sled : adj[node])
    {
        if(!pos[sled]) dfs(sled);
    }
    dist--;
}

void Reset()
{
    for(int i = 1; i <= n; i++)
    {
        pos[i] = 0;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i < n; i++)
    {
        cin >> x >> y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    cin >> q;
    for(int i = 1; i <= q; i++)
    {
        cin >> b[i].F >> b[i].S;
    }
    minrez = INT_MAX;
    for(int i = 1; i <= n; i++)
    {
        dist = 0;
        rez = 0;
        Reset();
        dfs(i);
        if(minrez > rez)
        {
            minrez = rez;
            minrezI = i;
        }
    }
    cout << minrezI << "\n";
    for(int j = 1; j <= q; j++)
    {
        a[b[j].S] += b[j].F;
        minrez = INT_MAX;
        for(int i = 1; i <= n; i++)
        {
            dist = 0;
            rez = 0;
            Reset();
            dfs(i);
            if(minrez > rez)
            {
                minrez = rez;
                minrezI = i;
            }
        }
        cout << minrezI << "\n";
    }
    return 0;
}