#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using vt = vector<T>;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define SZ(x) ((int)((x).size()))
#define EACH(x, a) for (auto& x: a)
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))
const double pi = 4 * atan(1);
using ll = long long;
using pll = pair<ll, ll>;


mt19937 mt_rng(chrono::steady_clock::now().time_since_epoch().count());
ll randint(ll a, ll b) {
	return uniform_int_distribution<ll>(a, b)(mt_rng);
}

template<class T> bool umin(T& a, const T& b) {
	return b<a?a=b, 1:0;
}
template<class T> bool umax(T& a, const T& b) { 
	return a<b?a=b, 1:0;
}

template<class ForwardIterator> void print_vec(ForwardIterator first,
		ForwardIterator last, string sep = " ", string end = "\n") {
	bool ft = true;
	while (first != last) {
		if (!ft) {cout << sep;} else {ft = false;}
		cout << (*first);
		++first;
	}
	cout << end;
}

template<typename T1, typename T2>
std::ostream& operator<<(std::ostream &o, const pair<T1, T2> &p) {
	return o << p.F << " " << p.S;
}

inline ll floorDiv(ll x, ll y) {
	ll d = x / y;
	ll r = x % y;
	return r ? (d - ((x < 0) ^ (y < 0))) : d;
}

ll ceilDiv(ll x, ll y) {
	return -floorDiv(-x, y);
}

ll bin_search(ll lo, ll hi, function<bool(ll)> predicate) {
	int sign = lo < hi ? 1 : -1;
	lo *= sign;
	hi *= sign;
	hi++;
	while (lo < hi) {
		ll mid = lo + floorDiv(hi-lo, 2);
		if (!predicate(sign * mid)) {
			lo = mid + 1;
		} else {
			hi = mid;
		}
	}
	return sign * lo;
}
const ll MOD = 1000000007;
const int MAXN = 200005;

vector<ll> down;
vector<vector<int>> adj;
set<pair<int,int> > usual;
map<pair<int,int>, int > ids;
vector<ll> ans;
ll current = 0;

void dfs(int u, int p) {
	for (auto &v : adj[u]) {
		if (v != p) {
			usual.insert({u,v});
			dfs(v,u);
		}
	}
}

void dfs2(int u, int p) {
	ans[u] = current;
	for (auto &v : adj[u]) {
		if (v != p) {
			int idx = ids[make_pair(u,v)];
			current+=down[idx];
			dfs2(v, u);
			current-=down[idx];
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	
	down.assign(n-1,0);
	ans.assign(n,0);
	
	vector<pair<int,int>> edge;
	adj.assign(n,vector<int>());
	
	for (int i = 0; i < n-1; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		adj[x].pb(y);
		adj[y].pb(x);
		edge.pb({x,y});
		ids[make_pair(x,y)]=ids[make_pair(y,x)]=i;
	}
	
	dfs(0,0);
	
	int q;
	cin >> q;
	while(q--) {
		int t, e;
		ll x;
		cin >> t >> e >> x;
		t--;
		t=1-t;
		e--;
		if (! usual.count(edge[e])) {
			t=1-t;
		}
		if (t) {
			current+=x;
			down[e]+=-x;
		} else {
			down[e]+=x;
		}
	}
	
	dfs2(0,0);
	
	print_vec(ans.begin(),ans.end(), "\n");

	
}

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
signed main(){
	int n;
	cin>>n;
	vector<pair<int,int>> ed(n-1);
	vector<vector<int>> g(n);
	for(int i=0;i<n-1;i++){
		int u,v;
		cin>>u>>v;
		ed[i]={u-1,v-1};
		g[u-1].push_back(v-1);
		g[v-1].push_back(u-1);
	}
	vector<int> d(n,-1),s(n);
	//dfs using stack
	vector<int> q={0};d[0]=0;
	while(q.size()){
		int u=q.back();
		q.pop_back();
		for(int v:g[u]){
			if(d[v]==-1){
				d[v]=d[u]+1;
				q.push_back(v);
			}
		}
	}
	int Q;cin>>Q;
	while(Q--){
		int t,e,x;cin>>t>>e>>x;
		auto [a,b]=ed[e-1];
		if(d[a]>d[b]){
			swap(a,b);
			if(t==1)t=2;
			else t=1;
		}
		if(t==1){
			s[0]+=x;s[b]-=x;
		}
		else s[b]+=x;
	}

	q={0};
	while(q.size()){
		int u=q.back();
		q.pop_back();
		for(int v:g[u]){
			if(d[u]<d[v]){
				s[v]+=s[u];
				q.push_back(v);
			}
		}
	}

	for(int i:s)cout<<i<<"\n";

}
