#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




#define SIZE 400005


struct Edge{


	int a,b;
};


ll N = 1;
ll uniformity[6*SIZE],partial[6*SIZE];
int global_index = 0;
int LEFT[SIZE],RIGHT[SIZE];
vector<int> G[SIZE];
Edge edge[SIZE];


void init(ll first_N){
	while(N < first_N)N *= 2;
}

void add(ll left,ll right,ll value,ll node_id,ll node_left,ll node_right){

	if(right <= node_left || left >= node_right)return;
	else if(left <= node_left && right >= node_right){
		uniformity[node_id] += value;
	}else{
		partial[node_id] += (min(right,node_right)-max(left,node_left))*value;
		add(left,right,value,2*node_id+1,node_left,(node_left+node_right)/2);
		add(left,right,value,2*node_id+2,(node_left+node_right)/2,node_right);
	}
}

ll getSum(ll left,ll right,ll node_id,ll node_left,ll node_right){
	if(right <= node_left || left >= node_right)return 0;
	else if(left <= node_left && right >= node_right){
		return (node_right-node_left)*uniformity[node_id]+partial[node_id];

	}else{
		ll sum = (min(right,node_right)-max(left,node_left))*uniformity[node_id];

		sum += getSum(left,right,2*node_id+1,node_left,(node_left+node_right)/2);
		sum += getSum(left,right,2*node_id+2,(node_left+node_right)/2,node_right);
		return sum;
	}
}

//オイラーツアーで、ノードのカバー範囲を計算する
void euler_tour(int node_id,int pre_node){
	LEFT[node_id] = global_index++;

	for(int i = 0; i < G[node_id].size(); i++){
		if(G[node_id][i] == pre_node)continue;
		euler_tour(G[node_id][i],node_id);
	}
	RIGHT[node_id] = global_index++;
}



int main(){

	ll first_N;
	scanf("%lld",&first_N);



	int from,to;
	for(int i = 0; i < first_N-1; i++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		edge[i].a = from;
		edge[i].b = to;

		G[from].push_back(to);
		G[to].push_back(from);
	}

	euler_tour(0,-1);

	init(RIGHT[0]);

	for(ll i = 0; i <= 2*N-2; i++){
		uniformity[i] = 0;
		partial[i] = 0;
	}

	int command,tmp;
	ll x;

	int a,b;

	ll Q;
	scanf("%lld",&Q);

	for(ll i = 0; i < Q; i++){

		//printf("クエリ;%lld\n",i);

		scanf("%d %d %lld",&command,&tmp,&x);

		tmp--;

		a = edge[tmp].a;
		b = edge[tmp].b;

		//printf("a:%d b:%d\n",a,b);

		if(command == 1){ //a[tmp]からたどる

			if(LEFT[a] < LEFT[b]){ //Aの方が外側

				add(LEFT[0],RIGHT[0]+1,x,0,0,N);
				add(LEFT[b],RIGHT[b]+1,-x,0,0,N);

			}else{ //Aの方が内側

				add(LEFT[a],RIGHT[a]+1,x,0,0,N);
			}
			//printf("%d-%dから引き\n",LEFT[b],RIGHT[b]);

		}else{ //command == 2;

			if(LEFT[b] < LEFT[a]){ //bの方が外側

				add(LEFT[0],RIGHT[0]+1,x,0,0,N);
				add(LEFT[a],RIGHT[a]+1,-x,0,0,N);

			}else{ //bの方が内側

				add(LEFT[b],RIGHT[b]+1,x,0,0,N);
			}
		}
	}

	for(int i = 0; i < first_N; i++){

		printf("%lld\n",getSum(LEFT[i],LEFT[i]+1,0,0,N));
	}

	return 0;
}

#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define eps (double)(1e-9)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

using Graph = vector<vector<int>>;

vector<ll> d, sum;
void dfs1(const Graph &G, int v, int p, int D) { 
	d[v] = D;
    for (auto nv : G[v]) {
		if (nv == p)continue;
		dfs1(G, nv, v, D+1);
	}
}

void dfs2(const Graph &G, int v, int p){ 
    for (auto nv : G[v]) {
		if (nv == p)continue;
        sum[nv] += sum[v];
		dfs2(G, nv, v);
	}
}

int main() {
    int n, q;
    cin >> n;
    Graph G(n);
    vector<ll> a(n-1), b(n-1);
    rep(i, n-1){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    d.resize(n);
    sum.resize(n);
    dfs1(G, 0, -1, 0);
    cin >> q;
    rep(i, q){
        ll t, e, x;
        cin >> t >> e >> x; e--; 
        if(t == 1){
            if(d[a[e]] < d[b[e]]){
                sum[0] += x;
                sum[b[e]] -= x;
            }else{
                sum[a[e]] += x;
            }
        }else{
            if(d[b[e]] < d[a[e]]){
                sum[0] += x;
                sum[a[e]] -= x;
            }else{
                sum[b[e]] += x;
            }
        }
    }
    dfs2(G, 0, -1);
    rep(i, n)cout << sum[i] << endl;
}   