#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define int ll
#define each(i, a) for (auto &&i : (a))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using P = pair<int, int>;
using vp = vector<P>;
using int128 = __int128_t;//cin coutはできない
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a / gcd(a, b) * b;};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template <class T>
void CVEC(const T &v) {
	int c = v.size() - 1;
	for (int i = 0; i < c; i++) cout << v[i] << ' ';
	if (c > -1) cout << v[c];
	cout << '\n';
}

#pragma endregion header

vvi es;
vi a, b;
vi depth, dp;

void DepthDFS(int v, int d){
	depth[v] = d;
	for(auto nv : es[v]){
		if(depth[nv] == -1) DepthDFS(nv, d+1);
	}
}

void ImosDFS(int v, int now){
	now += dp[v];
	dp[v] = now;
	for(auto nv : es[v]){
		if(depth[nv] > depth[v]){
			ImosDFS(nv, now);
		}
	}
}


signed main(){
    int n; cin >> n;
	es.resize(n);
	a.resize(n-1);
	b.resize(n-1);
	depth.assign(n, -1);
	dp.assign(n,0);
	rep(i,n-1){
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		es[a[i]].push_back(b[i]);
		es[b[i]].push_back(a[i]);
	}
	DepthDFS(0,0);
	int q;
	cin >> q;
	rep(i,q){
		int t, e, x; cin >> t >> e >> x;
		e--;
		int va, vb;
		if(t == 1){
			va = a[e];
			vb = b[e];
		}else{
			va = b[e];
			vb = a[e];
		}
		if(depth[va] < depth[vb]){
			//根に足す
			dp[0] += x;
			//通らない方を引く
			dp[vb] -= x;
		}else{
			//部分木に足す
			dp[va] += x;
		}
	}
	ImosDFS(0,0);
	rep(i,n){
		cout << dp[i] << endl;
	}
}
#include<bits/stdc++.h>
#define F(i,l,r) for(register int i=l;i<=r;i++)
#define D(i,r,l) for(register int i=r;i>=l;i--)
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
#define p_b push_back
#define m_p make_pair
#define il inline
#define fi first
#define se second
const int INF=0x7f7f7f7f,N=2e5+5;
using namespace std;
template<typename T> void rd(T &num) {
	char ch=getchar();
	num=0;
	int k=1;
	while((ch>'9'||ch<'0')&&ch!='-') ch=getchar();
	if(ch=='-') k=-1,ch=getchar();
	while(ch<='9'&&ch>='0') num=num*10+ch-'0',ch=getchar();
	num*=k;
}
int n,T;
int u[N],v[N];
int op,e;ll x;
vector<int> mp[N];
int L[N],R[N],dep[N];
int cnt;
void dfs(int p,int fa) {
	dep[p]=dep[fa]+1;
	L[p]=++cnt;
	F(i,0,(int)mp[p].size()-1) {
		int to=mp[p][i];
		if(to!=fa) dfs(to,p);
	}
	R[p]=cnt;
}
ll ans[N<<2],tag[N<<2];
il int ls(int p) {return p<<1;}
il int rs(int p) {return p<<1|1;}
il void push_up(int p) {ans[p]=ans[ls(p)]+ans[rs(p)];}
il void f(int p,int l,int r,ll k) {
	ans[p]+=(r-l+1)*k;
	tag[p]+=k;
}
il void push_down(int p,int l,int r) {
	if(tag[p]) {
		int mid=(l+r)>>1;
		f(ls(p),l,mid,tag[p]);
		f(rs(p),mid+1,r,tag[p]);
		tag[p]=0;
	}
}
il void upd(int p,int l,int r,int nl,int nr,ll k) {
	if(nl<=l&&nr>=r) {
		f(p,l,r,k);
		return ;
	}
	push_down(p,l,r);
	int mid=(l+r)>>1;
	if(nl<=mid) upd(ls(p),l,mid,nl,nr,k);
	if(nr>mid) upd(rs(p),mid+1,r,nl,nr,k);
	push_up(p);
}
il ll query(int p,int l,int r,int ql,int qr) {
	ll res=0;
	if(ql<=l&&qr>=r) return ans[p];
	push_down(p,l,r);
	int mid=(l+r)>>1;
	if(ql<=mid) res+=query(ls(p),l,mid,ql,qr);
	if(qr>mid) res+=query(rs(p),mid+1,r,ql,qr);
	return res;
}
int main() {
	rd(n);
	F(i,1,n-1) {
		rd(u[i]),rd(v[i]);
		mp[u[i]].p_b(v[i]),mp[v[i]].p_b(u[i]);
	}
	dfs(1,0);
	// F(i,1,n) {
		// printf("dep:%d st_l:%d st_r:%d\n",dep[i],L[i],R[i]);
	// }
	rd(T);
	while(T--) {
		rd(op),rd(e),rd(x);
		int st=u[e],nd=v[e];
		if(op==2) swap(st,nd);
		if(dep[st]>dep[nd]) upd(1,1,n,L[st],R[st],x);
		else upd(1,1,n,L[1],R[1],x),upd(1,1,n,L[nd],R[nd],-x);
	}
	F(i,1,n) printf("%lld\n",query(1,1,n,L[i],L[i]));
	return 0;
}