/**
 *    author:  wxhtzdy
 *    created: 19.11.2022 13:47:47
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);  
  int n;
  cin >> n;
  vector<vector<int>> g(n);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    --u; --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long sum = 0;
  function<void(int, int, int)> Dfs = [&](int v, int pv, int dep) {
    sum += dep * 1LL * a[v];
    for (int u : g[v]) {
      if (u == pv) {
        continue;
      }
      Dfs(u, v, dep + 1);
    } 
  };
  auto Solve = [&]() {
    long long mn = 1e18;
    int idx = -1;
    for (int i = 0; i < n; i++) {
      sum = 0;
      Dfs(i, i, 0);       
      if (sum < mn) {
        mn = sum;
        idx = i;
      }
    }
    return idx + 1;
  };
  cout << Solve() << '\n';
  int q;
  cin >> q;
  while (q--) {
    int z, b;
    cin >> z >> b;
    --b;
    a[b] += z;
    cout << Solve() << '\n';
  }
  return 0;
}