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

const int MAXN = 200002;
vector<int> g[MAXN];
long long zlatnici[MAXN];

long long k[MAXN];

int dfsAns(int x, int from) {
	for(auto u : g[x]) {
		if(u == from) continue;
		int diff = (k[1] - k[u]) - k[u];
		//cout << (k[1] - k[u]) << " " << k[u] << endl;
		//cout << diff << endl;
		if(diff < 0) return dfsAns(u, x);
	}
	return x;
}

int dfs(int x, int from) {
	int val = 0;
	for(auto u : g[x]) {
		if(u != from)
			val += dfs(u, x);
	}

	val += zlatnici[x];
	k[x] = val;
	return val;
}

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n;
    cin >> n;

    for(int i = 0; i < n-1; i++){
    	int a, b;
    	cin >> a >> b;
    	g[a].push_back(b);
    	g[b].push_back(a);
   	}
   	for(int i = 1; i <= n; i++) {
   		cin >> zlatnici[i];
   	}

   	dfs(1, -1);
   	int ans = dfsAns(1, -1);
   	cout << ans << endl;
   	int m;
   	cin >> m;
   	for(int i = 0; i < m; i++) {
   		int z, b;
   		cin >> z >> b;
   		zlatnici[b] += z;
   		dfs(1, -1);
   		int ans = dfsAns(1, -1);	
   		cout << ans << endl;

   		//cout << k[i] << endl;
   	}

    
    return 0;
}