#include <bits/stdc++.h>
#include <cassert>
#define rep(i, N) for (int i = 0; i < (N); ++i)
#define rep2(i, a, b) for (ll i = a; i <= b; ++i)
#define rep3(i, a, b) for (ll i = a; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define ok() puts(ok ? "Yes" : "No");
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll, ll>;
template <class T> void takeUnique(vector<T> &v) {
  auto last = std::unique(v.begin(), v.end());
  v.erase(last, v.end());
}
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int dxx[] = {0, 1, 1, 1, 0, -1, -1, -1};
int dyy[] = {1, 1, 0, -1, -1, -1, 0, 1};
// clang++ -std=c++11 -stdlib=libc++
//
vi to[200005];
int d[200005];
ll ans[200005];

void add(int v, int from = -1) {
  for (int u : to[v]) {
    if (u == from)
      continue;
    ans[u] += ans[v];
    add(u, v);
  }
}
void dfs(int v, int from = -1) {
  for (int u : to[v]) {
    if (u == from)
      continue;
    chmin(d[u], d[v] + 1);
    dfs(u, v);
  }
}

int main() {
  int n;
  cin >> n;
  rep(i, n) d[i] = INF;
  d[0] = 0;
  vi a(n - 1);
  vi b(n - 1);
  rep(i, n - 1) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    to[a[i]].pb(b[i]);
    to[b[i]].pb(a[i]);
  }
  dfs(0);
  int q;
  cin >> q;
  while (q--) {
    int t, i, x;
    cin >> t >> i >> x;
    i--;
    int avoid;
    int v;
    if (t == 1) {
      avoid = b[i];
      v = a[i];
    } else {
      avoid = a[i];
      v = b[i];
    }
    if (d[avoid] < d[v]) {
      ans[v] += x;
    } else {
      ans[0] += x;
      ans[avoid] -= x;
    }
  }
  add(0);
  rep(i, n) cout << ans[i] << '\n';
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=400005,INF=1<<30;
vector<pair<int,int>> G[MAX];
ll imo[MAX];
bool seen[MAX];
int s[MAX],g[MAX],timer;
pair<int,int> wh[MAX];

void DFS(int u){
    seen[u]=1;
    s[u]=timer;
    timer++;
    for(auto to:G[u]){
        if(seen[to.fi]) continue;
        
        wh[to.se]=mp(u,to.fi);
        DFS(to.fi);
    }
    g[u]=timer;
    timer++;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<pair<int,int>> E(N-1);
    for(int i=0;i<N-1;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        E[i]=mp(a,b);
        G[a].push_back(mp(b,i));
        G[b].push_back(mp(a,i));
    }
    
    DFS(0);
    
    //for(int i=0;i<N;i++) cout<<s[i]<<" "<<g[i]<<endl;
    
    int Q;cin>>Q;
    while(Q--){
        int t,e,x;cin>>t>>e>>x;
        e--;
        if(t==1){
            if(wh[e].fi==E[e].fi){
                imo[0]+=x;
                imo[s[wh[e].se]]-=x;
                imo[g[wh[e].se]+1]+=x;
                imo[2*N]-=x;
            }else{
                imo[s[wh[e].se]]+=x;
                imo[g[wh[e].se]+1]-=x;
            }
        }else{
            if(wh[e].fi==E[e].se){
                imo[0]+=x;
                imo[s[wh[e].se]]-=x;
                imo[g[wh[e].se]+1]+=x;
                imo[2*N]-=x;
            }else{
                imo[s[wh[e].se]]+=x;
                imo[g[wh[e].se]+1]-=x;
            }
        }
    }
    
    for(int i=1;i<2*N;i++) imo[i]+=imo[i-1];
    
    vector<ll> ans(N);
    
    for(int i=0;i<N;i++){
        cout<<imo[s[i]]<<endl;
    }
    
}
