//--------my brain isn't at home right now------------------
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define nl '\n'
typedef long long ll;
const int N = 2e5 + 1;
vector<int> g[N];
vector<pair<int, int>> v(N);
ll dp[N];
vector<int> parent(N);
void dfs1(int u, int t = -1){
for(auto x: g[u]){
if(x == t) continue;
parent[x] = u;
dfs1(x, u);
}
}
void dfs(int u, int k = -1){
for(auto x: g[u]){
if(x == k) continue;
dp[x] += dp[u];
dfs(x, u);
}
}
void Solve(){
int n;
cin>>n;
for(int i = 1; i < n; i++){
int a, b;
cin>>a>>b;
v[i] = {a, b};
g[a].pb(b);
g[b].pb(a);
}
for(int i = 0; i < N; i++){
dp[i] = 0;
parent[i] = 0;
}
dfs1(1);
int q;
cin>>q;
while(q--){
int t, e, x;
cin>>t>>e>>x;
int a = v[e].fi;
int b = v[e].se;
if(t == 1){
if(parent[b] == a){
dp[1] += x;
dp[b] -= x;
}
else{
dp[a] += x;
}
}
else{
if(parent[a] == b){
dp[1] += x;
dp[a] -= x;
}
else{
dp[b] += x;
}
}
}
dfs(1);
for(int i = 1; i <= n; i++){
cout<<dp[i]<<nl;
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
Solve();
}
Ly8tLS0tLS0tLW15IGJyYWluIGlzbid0IGF0IGhvbWUgcmlnaHQgbm93LS0tLS0tLS0tLS0tLS0tLS0tCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+ICAKIAp1c2luZyBuYW1lc3BhY2Ugc3RkOyAKIAojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgc2Ugc2Vjb25kCiNkZWZpbmUgbmwgJ1xuJwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKCmNvbnN0IGludCBOID0gMmU1ICsgMTsKdmVjdG9yPGludD4gZ1tOXTsKdmVjdG9yPHBhaXI8aW50LCBpbnQ+PiB2KE4pOwpsbCBkcFtOXTsKdmVjdG9yPGludD4gcGFyZW50KE4pOwoKdm9pZCBkZnMxKGludCB1LCBpbnQgdCA9IC0xKXsKICAgIGZvcihhdXRvIHg6IGdbdV0pewogICAgICAgIGlmKHggPT0gdCkgY29udGludWU7CiAgICAgICAgcGFyZW50W3hdID0gdTsKICAgICAgICBkZnMxKHgsIHUpOwogICAgfQp9CnZvaWQgZGZzKGludCB1LCBpbnQgayA9IC0xKXsKICAgIGZvcihhdXRvIHg6IGdbdV0pewogICAgICAgIGlmKHggPT0gaykgY29udGludWU7CiAgICAgICAgZHBbeF0gKz0gZHBbdV07CiAgICAgICAgZGZzKHgsIHUpOwogICAgfQp9IAp2b2lkIFNvbHZlKCl7CiAgICBpbnQgbjsKICAgIGNpbj4+bjsKICAgIGZvcihpbnQgaSA9IDE7IGkgPCBuOyBpKyspewogICAgICAgIGludCBhLCBiOwogICAgICAgIGNpbj4+YT4+YjsKICAgICAgICB2W2ldID0ge2EsIGJ9OwogICAgICAgIGdbYV0ucGIoYik7IAogICAgICAgIGdbYl0ucGIoYSk7CiAgICB9CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgTjsgaSsrKXsKICAgICAgICBkcFtpXSA9IDA7CiAgICAgICAgcGFyZW50W2ldID0gMDsKICAgIH0KICAgIGRmczEoMSk7CiAgICBpbnQgcTsKICAgIGNpbj4+cTsKICAgIHdoaWxlKHEtLSl7CiAgICAgICAgaW50IHQsIGUsIHg7CiAgICAgICAgY2luPj50Pj5lPj54OwogICAgICAgIGludCBhID0gdltlXS5maTsKICAgICAgICBpbnQgYiA9IHZbZV0uc2U7CiAgICAgICAgaWYodCA9PSAxKXsKICAgICAgICAgICAgaWYocGFyZW50W2JdID09IGEpewogICAgICAgICAgICAgICAgZHBbMV0gKz0geDsKICAgICAgICAgICAgICAgIGRwW2JdIC09IHg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgIGRwW2FdICs9IHg7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZXsKICAgICAgICAgICAgaWYocGFyZW50W2FdID09IGIpewogICAgICAgICAgICAgICAgZHBbMV0gKz0geDsKICAgICAgICAgICAgICAgIGRwW2FdIC09IHg7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgIGRwW2JdICs9IHg7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBkZnMoMSk7CiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47IGkrKyl7CiAgICAgICAgY291dDw8ZHBbaV08PG5sOwogICAgfQoKfQppbnQgbWFpbigpeyAgCiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOyBjaW4udGllKDApOyBjb3V0LnRpZSgwKTsKICAgIFNvbHZlKCk7Cn0=