#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vl vector<ll>

int dx[4] = {0,-1,0,1};
int dy[4] = {-1,0,1,0};


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}

int n, q;
Graph G;
vi depth;
vl val;

void DepthDFS(int now, int d)
{
    depth[now] = d;
    for(int next: G[now]) {
        if(depth[next] == -1) {
            DepthDFS(next, d + 1);
        }
    }
}
void SumDFS(int now, ll weight)
{
    weight += val[now];
    val[now] = weight;
    for(int next: G[now]) {
        if(depth[next] > depth[now]) {
            SumDFS(next, weight);
        }
    }
}


int main()
{
    cin >> n;
    vi A(n - 1);
    vi B(n - 1);
    G.resize(n);
    depth.resize(n, -1);
    val.resize(n, 0);
    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]);
    }

    DepthDFS(0, 0);

    cin >> q;

    rep(i, q) {
        int t, e, x;
        cin >> t >> e >> x;
        e--;
        int a = A[e];
        int b = B[e];
        if(t == 2) swap(a, b);
        if(depth[a] > depth[b]) {
            val[a] += x;
        } else {
            val[0] += x;
            val[b] -= x;
        }
    }

    SumDFS(0, 0);
    rep(i, n) cout << val[i] << endl;
    

}
#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
#define endl "\n"
int N;
long long Ans[200005];
vector<int>to[200005];
class Tree {
public:
	Tree(int V, int root) : V(V), root(root) {
		T.resize(V);
		for (int i = 0; i < MAXLOGV; i++) parent[i].resize(V);
		depth.resize(V);
	}
	// uとvをつなぐ
	// lcaを求めることが主目的なので無向グラフとしている
	void unite(int u, int v) {
		T[u].push_back(v);
		T[v].push_back(u);
	}
	// initする
	// コンストラクタだけじゃなくてこれも呼ばないとlcaが求められないぞ
	void init() {
		dfs(root, -1, 0);
		for (int k = 0; k + 1 < MAXLOGV; k++) {
			for (int v = 0; v < V; v++) {
				if (parent[k][v] < 0) parent[k + 1][v] = -1;
				else parent[k + 1][v] = parent[k][parent[k][v]];
			}
		}
	}
	// uとvのlcaを求める
	int lca(int u, int v) const {
		if (depth[u] > depth[v]) swap(u, v);
		for (int k = 0; k < MAXLOGV; k++) {
			if ((depth[v] - depth[u]) >> k & 1) {
				v = parent[k][v];
			}
		}
		if (u == v) return u;
		for (int k = MAXLOGV - 1; k >= 0; k--) {
			if (parent[k][u] != parent[k][v]) {
				u = parent[k][u];
				v = parent[k][v];
			}
		}
		return parent[0][u];
	}
	// uとvの距離を求める
	// edgeを定義しないといけない時はこれじゃダメ
	int dist(int u, int v) const {
		int p = lca(u, v);
		return (depth[u] - depth[p]) + (depth[v] - depth[p]);
	}
	void dfs(int v, int p, int d) {
		parent[0][v] = p;
		depth[v] = d;
		for (int next : T[v]) {
			if (next != p) dfs(next, v, d + 1);
		}
	}
	static const int MAXLOGV = 25;
	// グラフの隣接リスト表現
	vector<vector<int> > T;
	// 頂点の数
	int V;
	// 根ノードの番号
	int root;

	// 親ノード
	vector<int> parent[MAXLOGV];
	// 根からの深さ
	vector<int> depth;
};

void dfs(int v, int p = -1) {
	if (-1 != p) {
		Ans[v] +=Ans[p];
	}
	for (int i = 0; i < to[v].size(); ++i) {
		if (p == to[v][i]) {
			continue;
		}
		dfs(to[v][i], v);
	}
	return;
}


int main() {
	cin >> N;
	vector<int>A(N);
	vector<int>B(N);
	Tree tree(N, 0);
	for (int i = 0; i < N - 1; ++i) {
		cin >> A[i] >> B[i];
		A[i]--;
		B[i]--;
		to[A[i]].push_back(B[i]);
		to[B[i]].push_back(A[i]);
		tree.unite(A[i], B[i]);
	}
 	tree.init();
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; ++i) {
		int t, e, x;
		cin >> t >> e >> x;
		e--;
		if (1 == t) {
			if (tree.depth[B[e]] < tree.depth[A[e]]) {
				Ans[A[e]] += x;
			}
			else {
				Ans[B[e]] -= x; 
				Ans[0] += x;
			}
		}
		else {
			if (tree.depth[A[e]] < tree.depth[B[e]]) {
				Ans[B[e]] += x;
			}
			else {
				Ans[A[e]] -= x;
				Ans[0] += x;
			}
		}
	}
	dfs(0);
	for (int i = 0; i < N; ++i) {
		cout << Ans[i] << endl;
	}
	return 0;
}