#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii; 
#define ll long long
#define ar array
const ll mxN=2e5;
const int mod=1e9+7;
const ll INF=1e18;
#define what_is(x) cerr << #x << " is " << x << endl;
ll a,b,n,k,q,m,x,y,h,l,r,t;
ll d[mxN],c[mxN];
vector<ll> adj[mxN];
void dfs(ll u=0,ll p=-1){
	for(ll v: adj[u]){
		if(v==p)continue;
		d[v]=d[u]+1;
		dfs(v,u);
	}
}

void dfs2(ll u=0,ll p=-1){
	
	for(ll v: adj[u]){
		if(v==p) continue;
		c[v]+=c[u];
		dfs2(v,u);
	}
}
void solve(){
	cin>>n;
	vector<ar<ll,2>> edges;
	for(ll i=0;i<n-1;i++){
		ll a,b;
		cin>>a>>b; --a,--b;
		edges.push_back({a,b});
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	dfs();
	cin>>q;
	while(q--){
		ll t,e,x;
		cin>>t>>e>>x;--e;
		if(t==1){
			if(d[edges[e][0]] < d[edges[e][1]]){
				c[edges[e][1]]-=x;
				c[0]+=x;
			}else{
				c[edges[e][0]]+=x;
			}
		}
		if(t==2){
			if(d[edges[e][0]] > d[edges[e][1]]){
				c[edges[e][0]]-=x;
				c[0]+=x;
			}else{
				c[edges[e][1]]+=x;
			}
		}
	}
	dfs2();
	for(ll i=0;i<n;i++){
		cout<<c[i]<<endl;
	}
}	


signed main() {
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    // cout.tie(0);
    cout<<setprecision(12)<<fixed;
    // cin>>t;
    // while(t--)
    	solve();
	return 0;
   
}
 
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N; cin >> N;
  vector<int64_t> a(N-1), b(N-1);
  vector<vector<int64_t>> l(N, vector<int64_t>(0));
  rep(i, N-1) {
    cin >> a.at(i) >> b.at(i);
    a.at(i)--; b.at(i)--;
    l.at(a.at(i)).push_back(b.at(i));
    l.at(b.at(i)).push_back(a.at(i));
  }
  int Q; cin >> Q;
  vector<int64_t> t(Q), e(Q), x(Q);
  rep(i, Q) {
    cin >> t.at(i) >> e.at(i) >> x.at(i);
    e.at(i)--;
  }
  vector<int64_t> tr(N, -1), temp(N, 0), d(N, -1);
  int64_t dn = 0;
  vector<int64_t> now = {0};
  while (now.size()) {
    vector<int64_t> next(0);
    rep(i, now.size()) if (d.at(now.at(i)) == -1) {
      d.at(now.at(i)) = dn;
      rep(j, l.at(now.at(i)).size()) next.push_back(l.at(now.at(i)).at(j));
    }
    dn++; now = next;
  }
  // rep(i, N) cout << d.at(i) << endl;
  rep(i, Q) {
    int64_t Qa, Qb;
    Qa = a.at(e.at(i)); Qb = b.at(e.at(i));
    if (t.at(i) == 2) swap(Qa, Qb);
    if (d.at(Qa) < d.at(Qb)) {
      temp.at(0) += x.at(i); temp.at(Qb) -= x.at(i);
    } else {
      temp.at(Qa) += x.at(i);
    }
    // rep(i, N) cout << temp.at(i) << endl;
  }
  now = {0};
  while (now.size()) {
    vector<int64_t> next(0);
    rep(i, now.size()) if (tr.at(now.at(i)) == -1) {
      tr.at(now.at(i)) = temp.at(now.at(i));
      rep(j, l.at(now.at(i)).size()) {
        next.push_back(l.at(now.at(i)).at(j));
        temp.at(l.at(now.at(i)).at(j)) += temp.at(now.at(i));
      }
    }
    dn++; now = next;
  }
  rep(i, N) cout << tr.at(i) << endl;
}