#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	vector<pair<int, int>> edges(n - 1);
	vector<vector<int>> adj(n);
	for(int i = 0; i < n-1; i++){
		int a, b;
		cin >> a >> b;
		--a, --b;
		edges[i] = {a, b};
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	
	vector<int> depth(n, -1);
	queue<int> q;
	depth[0] = 0;
	q.push(0);
	while(!q.empty()){
		int x = q.front();
		q.pop();
		for(int y: adj[x]){
			if(depth[y] < 0){
				depth[y] = 1 + depth[x];
				q.push(y);
			}
		}
	}
	
	vector<ll> save(n);
	int Q;
	cin >> Q;
	while(Q--){
		int t, e, x;
		cin >> t >> e >> x;
		
		auto [a, b] = edges[e - 1];
		if(t == 2) swap(a, b);
		
		if(depth[a] < depth[b]){
			save[0] += x;
			save[b] -= x;
		}
		else{
			save[a] += x;
		}
	}
	
	assert(q.empty());
	q.push(0);
	while(!q.empty()){
		int x = q.front();
		q.pop();
		for(int y: adj[x]){
			if(depth[y] > depth[x]){
				save[y] += save[x];
				q.push(y);
			}
		}
	}
	
	for(ll i: save){
		cout << i << "\n";
	}
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,7)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct edge { ll to, d1, d2; };
vector<vector<edge>> adj;
vector<ll> result;
ll pl = 0;

void dfs(ll n=0, ll p=-1, ll sum=0) {
  result[n] += sum;
  for (auto x: adj[n]) {
    if (x.to==p) continue;
    pl += x.d2;
    dfs(x.to,n,sum+(x.d1-x.d2));
  }
}

int main() {
  ll N; cin >> N;

  ll a[N-1], b[N-1]; rep(i,N-1) { cin >> a[i] >> b[i]; a[i]--; b[i]--; }
  ll toa[N-1] = {}, tob[N-1] = {};
  ll Q; cin >> Q;
  rep(i,Q) {
    ll t, e, x; cin >> t >> e >> x; e--;
    if (t==1) toa[e] += x;
    else tob[e] += x;
  }

  adj.resize(N);
  rep(i,N-1) {
    adj[a[i]].push_back({b[i],tob[i],toa[i]});
    adj[b[i]].push_back({a[i],toa[i],tob[i]});
  }

  result.resize(N); dfs();
  rep(i,N) result[i] += pl;
  debug(all(result));
  return 0;
}