#include <iostream>
#include <string>

using namespace std;

const int MaxN = 1001;
int z[200000], banka[200000];

struct Banka 
{
	int br = 0;
	long zlatnici;
	int portal[MaxN];
};
Banka b[MaxN];

long timpestin(int odakle, int prev)
{
	long s = 0;
	if (prev != 0)
		s = b[odakle].zlatnici;
	for (int i = 1; i <= b[odakle].br; i++)
		if (b[odakle].portal[i] != prev)
			s += timpestin(b[odakle].portal[i], odakle);
	return s;
}

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= min(n, MaxN - 1); i++)
	{
		int x, y;
		cin >> x >> y;
		b[x].br++;
		b[x].portal[b[x].br] = y;
		b[y].br++;
		b[y].portal[b[y].br] = x;
	}
	for (int i = 1; i <= min(n, MaxN - 1); i++)
		cin >> b[i].zlatnici;
	int q;
	cin >> q;
	for (int i = 0; i < q; i++)
		cin >> z[i] >> banka[i];
	long mini = LONG_MAX;
	int ind = 0;
	for (int i = 1; i < n; i++)
	{
		long t = timpestin(i, 0);
		if (t < mini)
		{
			ind = i;
			mini = t;
		}
	}
	cout << ind << endl;
	for (int j = 0; j < q; j++)
	{
		b[banka[j]].zlatnici += z[j];
		mini = LONG_MAX;
		ind = 0;
		for (int i = 1; i < n; i++)
		{
			long t = timpestin(i, 0);
			if (t < mini)
			{
				ind = i;
				mini = t;
			}
		}
		cout << ind << endl;
	}
	return 0;
}