#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll N = 2e5 + 42, stN = 4 * N;
ll t[stN] = {0};
void update(ll v, ll tl, ll tr, ll l, ll r, ll add) {
  if(l > r) return;
  if(l == tl && r == tr) t[v] += add;
  else {
    ll tm = (tl + tr) / 2;
    update((v << 1), tl, tm, l, min(r, tm), add);
    update((v << 1) + 1, tm + 1, tr, max(l, tm + 1), r, add);
  }
}
ll get(ll v, ll tl, ll tr, ll pos) {
  if(tl == tr) return t[v];
  ll tm = (tl + tr) / 2;
  if(pos <= tm) return t[v] + get((v << 1), tl, tm, pos);
  else return t[v] + get((v << 1) + 1, tm + 1, tr, pos);
}
vector<ll> g[N];
ll subt[N], dep[N];
ll stv[N];
ll cur = 0;
void dfs(ll v, ll p) {
  stv[v] = cur++;
  subt[v] = 1;
  for(auto& x : g[v])
    if(x != p) {
      dep[x] = dep[v] + 1;
      dfs(x, v);
      subt[v] += subt[x];
    }
}
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  ll n = 0;

  cin >> n;

  ll tot = 0;

  vector<pair<ll, ll> > ab(n);

  for(ll i = 1; i < n; i++) {
    ll a, b; cin >> a >> b;
    g[--a].pb(--b);
    g[b].pb(a);
    ab[i - 1] = mp(a, b);
  }

  dfs(0, -1);

  ll q = 0;

  cin >> q;

  while(q--) {
    ll t, e, x;
    cin >> t >> e >> x;
    e--;
    if(t == 1) {
      if(dep[ab[e].fi] > dep[ab[e].se]) {
        update(1, 0, n - 1, stv[ab[e].fi], stv[ab[e].fi] + subt[ab[e].fi] - 1, x);
      } else {
        tot += x;
        update(1, 0, n - 1, stv[ab[e].se], stv[ab[e].se] + subt[ab[e].se] - 1, -x);
      }
    } else {
      if(dep[ab[e].se] > dep[ab[e].fi]) {
        update(1, 0, n - 1, stv[ab[e].se], stv[ab[e].se] + subt[ab[e].se] - 1, x);
      } else {
        tot += x;
        update(1, 0, n - 1, stv[ab[e].fi], stv[ab[e].fi] + subt[ab[e].fi] - 1, -x);
      }
    }
  }

  for(ll i = 0; i < n; i++) cout << tot + get(1, 0, n - 1, stv[i]) << '\n';

  return 0;
}

#include <iostream>
#include <vector>
#include <utility>
#include <queue>

using namespace std;

int main()
{
    long long n;
    cin >> n;
    vector<pair<long long, long long>> edge_num(n);
    vector<vector<long long>> edge(n + 1);
    vector<long long> depth(n + 1, -1);

    for (long long i = 1; i <= n - 1; i++)
    {
        long long a, b;
        cin >> a >> b;
        edge.at(a).push_back(b);
        edge.at(b).push_back(a);
        edge_num.at(i).first = a;
        edge_num.at(i).second = b;
    }

    queue<long long> qu;
    depth.at(1) = 0;
    qu.push(1);
    while (qu.size() != 0)
    {
        long long p;
        p = qu.front();
        qu.pop();
        for (long long i = 0; i < edge.at(p).size(); i++)
        {
            if (depth.at(edge.at(p).at(i)) == -1)
            {
                depth.at(edge.at(p).at(i)) = depth.at(p) + 1;
                qu.push(edge.at(p).at(i));
            }
        }
    }
    //cout << "ask q" << endl;
    long long q;
    cin >> q;
    vector<long long> add_to_child(n + 1, 0);
    vector<long long> add_to_me(n + 1, 0);

    for (long long i = 0; i < q; i++)
    {
        long long t, e, x;
        cin >> t >> e >> x;
        long long from, to;
        if (t == 1)
        {
            from = edge_num.at(e).first;
            to = edge_num.at(e).second;
        }
        else
        {
            from = edge_num.at(e).second;
            to = edge_num.at(e).first;
        }
        if (depth.at(from) < depth.at(to))
        {
            add_to_child.at(1) += x;
            add_to_child.at(to) -= x;
        }
        else
        {
            add_to_child.at(from) += x;
        }
    }

    vector<long long> add_to_child_wfs(n + 1, -1);
    add_to_child_wfs.at(1) = add_to_child.at(1);
    qu.push(1);
    while (qu.size() != 0)
    {
        long long p;
        p = qu.front();
        qu.pop();
        for (long long i = 0; i < edge.at(p).size(); i++)
        {
            if (add_to_child_wfs.at(edge.at(p).at(i)) == -1)
            {
                add_to_child_wfs.at(edge.at(p).at(i)) = add_to_child_wfs.at(p) + add_to_child.at(edge.at(p).at(i));
                qu.push(edge.at(p).at(i));
            }
        }
    }

    for (long long i = 1; i <= n; i++)
    {
        cout << add_to_child_wfs.at(i) << "\n";
    }

    return 0;
}