#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy


const ll identity = 0;
const ll SZ = 131072*2;

ll sum[2*SZ], lazy[2*SZ];

ll combine(ll A, ll B) {
    return A+B;
}

ll combineUpd(ll A, ll B) {
    return A+B;
}

void push(int index, ll L, ll R) {
    sum[index] = combineUpd(sum[index], lazy[index]);
    if (L != R) lazy[2*index] = combineUpd(lazy[2*index], lazy[index]), lazy[2*index+1] = combineUpd(lazy[2*index+1], lazy[index]);
    lazy[index] = identity;
}

void pull(int index) {
    sum[index] = combine(sum[2*index], sum[2*index+1]);
}

ll query(int lo, int hi, int index = 1, ll L = 0, ll R = SZ-1) {
    push(index, L, R);
    if (lo > R || L > hi) return identity;
    if (lo <= L && R <= hi) return sum[index];

    int M = (L+R) / 2;
    return combine(query(lo, hi, 2*index, L, M), query(lo, hi, 2*index+1, M+1, R));
}

void update(int lo, int hi, ll increase, int index = 1, ll L = 0, ll R = SZ-1) {
    push(index, L, R);
    if (hi < L || R < lo) return;
    if (lo <= L && R <= hi) {
        lazy[index] = increase;
        push(index, L, R);
        return;
    }

    int M = (L+R) / 2;
    update(lo, hi, increase, 2*index, L, M); update(lo, hi, increase, 2*index+1, M+1, R);
    pull(index);
}
 
vector<vi> graph(MX);
int tin[MX], tout[MX], ct = 0;
void dfs(int v, int p) {
    tin[v] = ct;
    ct++;
    trav(a, graph[v]) {
        if (a == p) continue;
        dfs(a, v);
    }
    tout[v] = ct-1;
}


int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    vector<pi> edges;
    F0R(i, N-1) {
        int X, Y; cin >> X >> Y; X--; Y--; graph[X].pb(Y); graph[Y].pb(X);
        edges.pb({X, Y});
    }
    dfs(0, 0);
    int Q; cin >> Q;
    while(Q--) {
        int T, E, X; cin >> T >> E >> X;
        E--;
        int A = edges[E].f, B = edges[E].s;
        if (T == 2) swap(A, B);
        if (tin[B] < tin[A]) {
            update(tin[A], tout[A], X);
        } else {
            update(0, SZ-1, X);
            update(tin[B], tout[B], -X);
        }
    }
    F0R(i, N) {
        cout << query(tin[i], tin[i]) << nl;
    }
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
vector<vector<int>> es;
vector<int> depth;
void depth_dfs(int v, int pv=-1, int d=0) {
  depth[v] = d;
  for (int nv : es[v]) {
    if (nv == pv) continue;
    depth_dfs(nv, v, d+1);
  }
}
vector<ll> dp;
void imos_dfs(int v, int pv=-1) {
  if (pv>=0) dp[v] += dp[pv];
  for (int nv : es[v]) {
    if (nv == pv) continue;
    imos_dfs(nv, v);
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  es.resize(n);
  vector<int> a(n-1), b(n-1);
  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]);
  }
  depth.resize(n);
  depth_dfs(0);
  int q;
  cin >> q;
  dp.resize(n+5);
  rep(qi, q) {
    int t,e,x;
    cin >> t >> e >> x;
    e--;
    if (t == 1) {
      if (depth[a[e]] < depth[b[e]]) {
        dp[0] += x;
        dp[b[e]] -= x;
      } else {
        dp[a[e]] += x;
      }
    } else {
      if (depth[a[e]] < depth[b[e]]) {
        dp[b[e]] += x;
      } else {
        dp[0] += x;
        dp[a[e]] -= x;
      }
    }
  }
  imos_dfs(0);
  rep(i,n) cout << dp[i] << endl;
  return 0;
}
