#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define si(v) int(v.size())
#define len(v) int(v.length())
#define lob(v,n) lower_bound(all(v),n)
#define lobi(v,n) lower_bound(all(v),n) - v.begin()
#define upb(v,n) upper_bound(all(v),n)
#define upbi(v,n) upper_bound(all(v),n) - v.begin()
#define mod 1000000007
#define infi 1010000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}



int N;
ve<pii> G;
ve<ve<pair<int,ll>>> Q;
vl c;
ve<ve<pair<int,ll>>> QQ;

ll dfs(int u, int v, ll d){

    c[v] += d;
    ll res = 0;
    ll rr = 0;
    
    ve<pair<ll,int>> aa;
    
    for (pair<int,ll> p : Q[v]) {
        if(p.fi == u){
            res += p.se;
        }else{
            ll dd = dfs(v, p.fi, d+p.se);
            aa.pb({dd, p.fi});
            c[v] += dd;
            res += dd;
            rr += dd;
        }
    }
    
    for (auto p : aa) {
        QQ[v].pb({p.se,rr-p.fi});
    }
    
    return res;
    
    
    
    
}

void dfs1(int u, int v, ll d){

    c[v] += d;
    
    for (pair<int,ll> p : QQ[v]) {
        if(p.fi == u){
            continue;
        }else{
            dfs1(v, p.fi, d+p.se);
        }
    }
    
    
    return;
    
}






int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N;
    rep(i,N-1) {
        int a,b;
        cin >> a >> b;
        a--,b--;
        G.pb({a,b});
    }
    
    Q.resize(N);
    c.resize(N,0LL);
    QQ.resize(N);
    
    ve<pll> aaa(N-1,{0,0});
    
    int T;
    cin >> T;
    rep(i,T){
        int t,e; ll x;
        cin >> t >> e >> x;
        e--;
        if(t == 1) aaa[e].se += x;
        else aaa[e].fi += x;
    }
    
    
    rep(i,N-1){
        Q[G[i].fi].pb({G[i].se, aaa[i].fi});
        Q[G[i].se].pb({G[i].fi, aaa[i].se});
    }
    
    dfs(-1, 0, 0);
    dfs1(-1,0,0);
    rep(i,N) cout << c[i] << endl;
    
    
    

    return 0;
}

// Created by ash_98

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

#define mx 200005
#define ll long long
#define mod 1000000007


char ch[mx];
int n,m,ii,k;
pair<int,int>ar[mx];

namespace Segment_Tree
{
	const int N=200005;
	ll Tree[N*4];
	ll Lazy[N*4];

	void Relax(int node,int be,int en)
	{
		if(!Lazy[node])return;

		Tree[node]+=Lazy[node];
		if(be!=en)
		{
			Lazy[node*2]+=Lazy[node];
			Lazy[node*2+1]+=Lazy[node];
		}
		Lazy[node]=0;
	}

	void init(int node,int be,int en)
	{
		Lazy[node]=0;
        if(be==en)
        {
        	//Tree[node]=ar[be];
        	return;
        }
        int mid=(be+en)/2;
        init(node*2,be,mid);
        init(node*2+1,mid+1,en);
        Tree[node]=Tree[node*2]+Tree[node*2+1];
	}

	void update(int node,int be,int en,int pos,int val)
	{
		Relax(node,be,en);
		if(be> pos || en<pos)return;
		if(be==en)
		{
			Tree[node]+=val;
			return;
		}
		int mid=(be+en)/2;
		update(node*2,be,mid,pos,val);
		update(node*2+1,mid+1,en,pos,val);
		Tree[node]=max(Tree[node*2],Tree[node*2+1]);
	}

	void Rupdate(int node,int be,int en,int i,int j,int val)
	{
		Relax(node,be,en);
		if(be>j || en<i)return ;
		if(be>=i && en<=j)
		{
			Lazy[node]+=val;
			Relax(node,be,en);
			return;
		}
		int mid=(be+en)/2;
		Rupdate(node*2,be,mid,i,j,val);
		Rupdate(node*2+1,mid+1,en,i,j,val);
		Tree[node]=Tree[node*2]+Tree[node*2+1];
	}

	ll query(int node,int be,int en,int i,int j)
	{
		Relax(node,be,en);
		if(be>j || en<i)return 0;
		if(be>=i && en<=j)return Tree[node];
		int mid=(be+en)/2;
		return query(node*2,be,mid,i,j)+query(node*2+1,mid+1,en,i,j);
	}

	void dbg_test(int node,int be,int en)
	{
		if(be==en)return;
		int mid=(be+en)/2;
		dbg_test(node*2,be,mid);
		dbg_test(node*2+1,mid+1,en);
	}
}

using namespace Segment_Tree;
int st[mx],en[mx];
int Final_array[mx];
vector<int>g[mx];

void dfs(int u,int p)
{
	st[u]=++k;
	for(int v:g[u])
	{
		if(v==p)continue;
		dfs(v,u);
	}
	en[u]=k;
}


void solve()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		g[x].push_back(y);
		g[y].push_back(x);
		ar[i]={x,y};
	}
	dfs(1,-1);
	scanf("%d",&m);
	ll ex=0;
	for(int i=1;i<=m;i++)
	{
		int ti,x,y;
		scanf("%d%d%d",&ti,&x,&y);
		if(ti==1)
		{
			int u=ar[x].first;
			int v=ar[x].second;
			if(st[u]>st[v])
			{
				Rupdate(1,1,n,st[u],en[u],y);
			}
			else
			{
				ex+=y;
				Rupdate(1,1,n,st[v],en[v],-y);

			}

		}
		else
		{
			int u=ar[x].second;
			int v=ar[x].first;
			if(st[u]>st[v])
			{
				Rupdate(1,1,n,st[u],en[u],y);
			}
			else
			{
				ex+=y;
				Rupdate(1,1,n,st[v],en[v],-y);

			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		ll re=ex+query(1,1,n,st[i],st[i]);
		printf("%lld\n",re );
	}
}

int main()
{
	int t=1;
	//scanf("%d",&t);
	while(t--)solve();
	return 0;
}