#include<bits/stdc++.h>
using namespace std;

const int N=2e+5+10;
vector<int> adj[N];
pair<int,int> edj[N];
int n,lft[N],rgt[N],t;
long long int c[N];

void dfs(int v,int p)
{
	lft[v]=++t;
	for(auto c:adj[v])
	{
		if(c!=p)
		{
			dfs(c,v);
		}
	}
	rgt[v]=t;
}
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		cin>>edj[i].first>>edj[i].second;
		adj[edj[i].first].push_back(edj[i].second);
		adj[edj[i].second].push_back(edj[i].first);
	}
	t=0;
	dfs(1,0);
	int q;
	cin>>q;
	while(q--)
	{
		int t,i;
		long long int x;
		cin>>t>>i>>x;
		int a=edj[i].first,b=edj[i].second;
		i = b;
		if(lft[a]>lft[b])
		{
			i=a;
			t=3-t;
		}
		if(t==1)
		{
			//i=edj[i].second;
			c[1]+=x;
			c[lft[i]]-=x;
			c[rgt[i]+1]+=x;
			c[n+1]-=x;
		}
		else
		{
			//i=edj[i].second;
			c[lft[i]]+=x;
			c[rgt[i]+1]-=x;
		}
	}
	for(int i=1;i<=n;i++)
	{
		//cout<<lft[i]<<" "<<rgt[i]<<" ";
		c[i]+=c[i-1];
		//cout<<c[i]<<"\n";
	}
	for(int i=1;i<=n;i++)
		cout<<c[lft[i]]<<"\n";
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); ++i)

ll INF = 1ll << 60;

int main(){
  int n;
  cin >> n;
  vl a(n-1), b(n-1);
  vvl g(n, vl(0));
  rep(i, 0, 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]);
  }
  
  vl dps(n,-1);
  dps[0] = 0;
  queue<ll> que;
  que.push(0);
  while(!que.empty()){
    ll d = que.front();
    que.pop();
    
    for(ll i : g[d]){
      if(dps[i] == -1){
        dps[i] = dps[d]+1;
        que.push(i);
      }
    }
  }
  
  int q;
  cin >> q;
  
  vl sum(n);
  
  rep(i, 0, q){
    ll t, e, x;
    cin >> t >> e >> x;
    e--;
    ll ae, be;
    ae = a[e];
    be = b[e];
    if(dps[ae] > dps[be]){
      t ^= 3;
      swap(ae, be);
    }
    
    if(t == 1){
      sum[0] += x;
      sum[be] -= x;
    }
    else{
      sum[be] += x;
    }
    
  }
  
  que.push(0);
  
  while(!que.empty()){
    ll d = que.front();
    que.pop();
    
    for(ll i : g[d]){
      if(dps[i] > dps[d]){
        sum[i] += sum[d];
        que.push(i);
      }
    }
  }
  
  rep(i, 0, n)
    cout << sum[i] << endl;
  
  return 0;
  
}