#include<bits/stdc++.h>
#define ls rt << 1
#define rs rt << 1 | 1
#define lson l , mid , rt << 1
#define rson mid + 1, r, rt << 1 | 1
#define lr2 (l + r) >> 1
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 50;
ll sum[maxn << 2], lazy[maxn << 2];
int L[maxn], R[maxn];
void push_up(int rt){
    sum[rt] = sum[ls] + sum[rs];
}
void push_down(int rt, int m){
    if(lazy[rt])
	{
		lazy[ls] += lazy[rt];
		lazy[rs] += lazy[rt];
		sum[ls] += lazy[rt] * (m - (m >> 1));
		sum[rs] += lazy[rt] * (m >> 1);
		lazy[rt] = 0;
	}
}
void update(int a, int b, ll v, int l, int r, int rt){
    if(a <= l && b >= r){
        sum[rt] += 1LL * (r - l + 1) * v;
        lazy[rt] += v;
        return;
    }
    push_down(rt, r - l + 1);
    int mid = lr2;
    if(a <= mid) update(a, b, v, lson);
    if(b > mid) update(a, b, v, rson);
    push_up(rt);
}
ll query(int a, int b, int l, int r, int rt){
    if(a <= l && b >= r){
        return sum[rt];
    }
    int mid = lr2;
    push_down(rt, r - l + 1);
    ll ans = 0;
    if(a <= mid) ans += query(a, b, lson);
    if(b > mid) ans += query(a, b, rson);
    return ans;
    push_up(rt);
}
int a[maxn], b[maxn];
int cnt, n;
vector<int> G[maxn];
int d[maxn];
void dfs(int v, int fa){
    L[v] = ++cnt;
    d[v] = d[fa] + 1;
    for(auto u : G[v]){
        if(u != fa){
            dfs(u, v);
        }
    }
    R[v] = cnt;
}
int main()
{
    std::ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 1;i < n;i++){
        cin >> a[i] >> b[i];
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    dfs(1, 0);
    int q;
    cin >> q;
    ll ans = 0;
    while(q--){
        int t, id;
        ll x;
        cin >> t >> id >> x;
        if(t == 1){
            if(d[a[id]] < d[b[id]]){
                ans += x;
                update(L[b[id]], R[b[id]], -x, 1, n, 1);
            }
            else update(L[a[id]], R[a[id]], x, 1, n, 1);
        }
        else{
            if(d[b[id]] < d[a[id]]){
                ans += x;
                update(L[a[id]], R[a[id]], -x, 1, n, 1);
            }
            else update(L[b[id]], R[b[id]], x, 1, n, 1);
        }
    }
    for(int i = 1;i <= n;i++) cout << query(L[i], L[i], 1, n ,1) + ans << endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
bool _DD = false;
#define _D(a)if(_DD)cout<<#a<<':'<<a<<" | ";
#define DBG(a){_D(a);if(_DD)cout<<'\n';}
#define DBG2(a,b){_D(a);_D(b);if(_DD)cout<<'\n';}
#define DBG3(a,b,c){_D(a);_D(b);_D(c);if(_DD)cout<<'\n';}
#define DBG4(a,b,c,d){_D(a);_D(b);_D(c);_D(d);if(_DD)cout<<'\n';}
#define DBG5(a,b,c,d,e){_D(a);_D(b);_D(c);_D(d);_D(e);if(_DD)cout<<'\n';}
#define DBG6(a,b,c,d,e,f){_D(a);_D(b);_D(c);_D(d);_D(e);_D(f);if(_DD)cout<<'\n';}
#define PB push_back
#define EB emplace_back
#define btoe(v) (v).begin(),(v).end()
#define etob(v) (v).rbegin(),(v).rend()
#define F first
#define S second
#define SZ size()

typedef unsigned long long int ulli;
typedef long long int lli;
typedef long double ldbl;
#define f(i,a,b) for(int i=(a); i<(b); ++i)
#define fr(i,a,b) for(int i=(a); i>(b); --i)
#define fl(i,a,b) for(lli i=(a); i<(b); ++i)
#define flr(i,a,b) for(lli i=(a); i>(b); --i)
#define w(x) lli x; cin>>x; while(x--) 
#define inpn(n,v,T) T n; cin>>n; vector<T> v(n); fl(i,0,n) cin>>v[i];
#define inp(n,v,T) vector<T> v(n); fl(i,0,n) cin>>v[i];

typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<pii> vpii;typedef vector<vector<pii>> vvpii;typedef pair<lli,lli> plli;typedef vector<lli> vlli;typedef vector<vlli> vvlli;typedef vector<plli> vplli;typedef vector<vector<plli>> vvplli;typedef vector<bool> vb;typedef vector<vb> vvb;typedef vector<string> vs;typedef vector<vector<string>> vvs; typedef vector<char> vc; typedef vector<vc> vvc;
#define unmp unordered_map

const lli PRIME = 1000000007ll;
const lli PRIME2 = 998244353ll;

inline void debugORfast(bool a=0,bool b=1){
    if(a) _DD=1;
    if(b){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
}

//Question Link 
class mysort{
    public:
	bool operator() (const plli &p1, const plli &p2){
	    if(p1.F+p1.S>p2.F+p2.S) return true;
	    else if(p1.F+p1.S==p2.F+p2.S){
		if(p1.F>p2.F) return true;
	    	else return false;
	    }
	    else return false;
	}
}mysorto;

vi times;
vlli ans;
void dfsh(const vvi &g, int n, int p, int &t, const vlli &c, vb &vis){
    vis[n] = true;
    times[n] = t++;
    ans[n] = ans[p]+c[n];
    for(int ch:g[n]){
	if(ch!=p and !vis[ch]) dfsh(g,ch,n,t,c,vis);
    }
}

void dfs(const vvi &g, const vlli &c){
    times.clear();
    times.resize(g.size(),0);
    ans.clear();
    ans.resize(g.size(),0);
    vb vis(g.size(),false);
    int t = 0;
    dfsh(g,1,0,t,c,vis);
}

int main(int argc,char* argv[]) 
{
    if(argc>1 and strcmp(argv[1],"1")==0) debugORfast(1,1);
    else debugORfast(0,1);

    /*
       int n; cin>>n;
       lli asum = 0;
       vplli v(n);
       f(i,0,n){
       cin>>v[i].F>>v[i].S;
       asum += v[i].F;
       }
       sort(btoe(v),mysorto);

    //f(i,0,n){
    //    cout<<v[i].F<<'-'<<v[i].S<<endl;
    //}

    lli bsum = 0,asumsmall=0;
    f(i,0,n){
    asumsmall += v[i].F;
    bsum += (v[i].F+v[i].S);
    if(bsum>(asum-asumsmall)){
    cout<<i+1<<endl;
    break;
    }
    }
    */

    int n; cin>>n;
    vvi g(n+1);
    vpii e(n+1);
    f(i,1,n){
	int a,b; cin>>a>>b;
	e[i].F = a; e[i].S = b;
	g[a].PB(b);
	g[b].PB(a);
    }

    vlli c(n+1,0);
    dfs(g,c); //pops times

    //f(i,1,times.SZ) cout<<times[i]<<' '; cout<<endl;

    w(qq){
	lli t,ei,x;
	cin>>t>>ei>>x;

	int a = e[ei].F;
	int b = e[ei].S;

	//cout<<a<<' '<<b<<endl;

	if(t==2) swap(a,b);

	if(times[a]<times[b]){
	    c[1]+=x; c[b]-=x;
	}else{
	    c[a]+=x;
	}
    }

    //f(i,1,c.SZ) cout<<c[i]<<' '; cout<<endl;

    dfs(g,c);

    f(i,1,ans.SZ){
        cout<<ans[i]<<endl;
    }

    return 0;
}
