#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
#define P pair<int,int>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
#define T tuple<int, int, int>

const int MAX_N = 2e5;

vvi G(MAX_N);

void reveal(int v, int cnt, vi &ranks){
    ranks[v] = cnt;

    for (int nv : G[v]){
        if (ranks[nv] != -1) continue;
        reveal(nv, cnt+1, ranks);
    }
    
}

void imos_dfs(int v, ll cnt, vector<ll> &V, vi &ranks){
    cnt += V[v];
    V[v] = cnt;

    for (int nv : G[v]){
        if (ranks[nv] < ranks[v]) continue;
        imos_dfs(nv, cnt, V, ranks);
    }
}





int main(){
    int n;
    cin >> n;

    vector<ll> V(MAX_N);
    vector<P> E;
    vi ranks(MAX_N, -1);

    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);

        E.push_back(P(a, b));
    }

    reveal(0, 0, ranks);

    int q;
    cin >> q;
    rep(i,q){
        int t, e, x;
        cin >> t >> e >> x;
        e--;

        int a = E[e].first;
        int b = E[e].second;

        if (t == 1){
            if (ranks[a] > ranks[b]){
                V[a] += x;
            } else {
                V[0] += x;
                V[b] -= x;
            }
        } else {
            if (ranks[b] > ranks[a]){
                V[b] += x;
            } else {
                V[0] += x;
                V[a] -= x;
            }
        }
    }


    imos_dfs(0, 0, V, ranks);

    rep(i,n){
        cout << V[i] << endl;
    }
}
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<pair<int, int>> VW(N);
    for(int i=0; i<N; i++){
        int w, v;
        cin >> w >> v;
        VW[i] = {v, w};
    }
    sort(VW.rbegin(), VW.rend());
    vector<int> X(M);
    for(int i=0; i<M; i++) cin >> X[i];

    while(Q--){
        int l, r;
        cin >> l >> r;
        l--; r--;
        multiset<int> st;
        for(int i=0; i<l; i++) st.insert(X[i]);
        for(int i=r+1; i<M; i++) st.insert(X[i]);
        int ans = 0;
        for(auto [v, w] : VW){
            auto it = st.lower_bound(w);
            if(it != st.end()){
                ans += v;
                st.erase(it);
            }
        }
        cout << ans << endl;
    }
    return 0;
}
