/*Jai Shree Ram*/
// Never Give Up
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define mt19937                 rng(chrono::steady_clock::now().tjhe_since_epoch().count());
//shuffle(arr,arr+n,rng)
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
mii m;
pii child[200001];
int t = 1;
int BIT[200001];
void update(int i,int n,int inc)
{
  
  while(i<=n)
  {
    BIT[i] += inc;
    i += (i & (-i));
  }
}
int query(int i)
{
  int ans = 0;
  while(i>0)
  {
      ans += BIT[i];
      i -= (i&(-i));
  }
  return ans;
}
void updateRange(int l,int r,int inc,int n)
{
  if(l>r)
    return;
  update(l,n,inc);
  update(r+1,n,-inc);
}
class graph 
{
  int V;
  list<int>* l;
public:
  graph(int V)
  {
    this->V = V;
    l = new list<int>[V+1];
  }
  void addEdge(int x,int y)
  {
    l[x].pb(y);
    l[y].pb(x);
  }
  void dfs(int src,int par)
  {
     m[src] = t;
     child[m[src]].ff = t;
      t++;
     for(int nbr:l[src])
     {
      if(nbr!=par)
      {
        dfs(nbr,src);
      }
     }
     child[m[src]].ss = t-1;
  }
};
int32_t main()
{   c_p_c();
  memset(BIT,0,sizeof(BIT));
    int n;
    cin>>n;
    graph g(n+1);
    vector<pii> edges;
    for(int i=0;i<n-1;i++)
    {
      int a,b;
      cin>>a>>b;
      g.addEdge(a,b);
      edges.pb(mp(a,b));

    }
    g.dfs(1,-1);
  
    w(q)
    {
      int t;
      cin>>t;
      int idx,inc;
      cin>>idx>>inc;
      idx--;
      int b = max(m[edges[idx].ff],m[edges[idx].ss]);
       
      if((t==1&& m[edges[idx].ss]==b)||(t==2 && m[edges[idx].ff]==b))
      { 
         updateRange(1,child[b].ff-1,inc,n);
         updateRange(child[b].ss+1,n,inc,n);
      }
      else
      {
         updateRange(child[b].ff,child[b].ss,inc,n);
      }
    }
    for(int i=1;i<=n;i++)
      cout<<query(m[i])<<endl;
}
#include <bits/stdc++.h>

using namespace std;

// Templates here
template<typename T1, typename T2, typename T3>
class triple {
public:
    T1 first;
    T2 second;
    T3 third;

    triple() {
        first = 0;
        second = 0;
        third = 0;
    }
};

// Typedefs here
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef set<int> si;
typedef set<ll> sl;
typedef set<pii> spii;
typedef set<pll> spll;
typedef map<string, int> mpsi;
typedef map<string, ll> mpsl;
typedef map<int, int> mpii;
typedef map<ll, ll> mpll;

// Defines here
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define fora(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define forla(i, a, b) for(ll (i)=(a);(i)<(b);(i)++)
#define for0(i, b) fora((i),0,(b))
#define forl0(i, b) forla((i),0,(b))
#define rofa(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define rofla(i, a, b) for(ll (i)=(a);(i)>=(b);(i)--)
#define rof0(i, a) rofa((i),(a),0)
#define rofl0(i, a) rofla((i),(a),0)
#define forag(i, a, b, g) for(int (i)=(a);(i)<(b);(i)+=(g))
#define forlag(i, a, b, g) for(ll (i)=(a);(i)<(b);(i)+=(g))
#define for0g(i, b, g) forag((i),0,(b),(g))
#define forl0g(i, b, g) forlag((i),0,(b),(g))
#define rofag(i, a, b, g) for(int (i)=(a);(i)>=(b);(i)-=(g))
#define roflag(i, a, b, g) for(ll (i)=(a);(i)>=(b);(i)-=(g))
#define rof0g(i, a, g) rofag((i),(a),0,(g))
#define rofl0g(i, a, g) roflag((i),(a),0,(g))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define T third
#define GraphM1(g, n) int (g)[(n)][(n)]
#define GraphM2(g, n) vi (g)[(n)]

// Const variables here
const int maxn = 2e5 + 10;

// Global variables here
int n, q, a[maxn], b[maxn], par[maxn];
ll part[maxn];
GraphM2(g, maxn);
bool visited[maxn];

// Functions here
void dfs(int v, int p) {
    par[v] = p;
    visited[v] = true;

    for (auto u: g[v])
        if (!visited[u]) {
            part[u] += part[v];
            dfs(u, v);
        }

}

// Main here
int main() {
    IOS

    cin >> n;

    fora(i, 1, n) {
        cin >> a[i] >> b[i];
        g[a[i]].pb(b[i]);
        g[b[i]].pb(a[i]);
    }

    dfs(1, 0);

    cin >> q;

    for0(i, q) {
        int t, e, x, u, v;
        cin >> t >> e >> x;

        if (t == 1) {
            u = a[e];
            v = b[e];
        } else {
            v = a[e];
            u = b[e];
        }

        if (u == par[v]) {
            part[1] += x;
            part[v] -= x;
        } else
            part[u] += x;

    }

    memset(visited, 0, n + 2);

    dfs(1, 0);

    fora(i, 1, n + 1)cout << part[i] << "\n";

    return 0;
}