#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
#define MAX_V 200001 //10^5
int V,E,depth[MAX_V];  //dは開始ノードからの距離=深さ
typedef long long ll;
ll val[MAX_V];

//numは辺番号。消しても良いし、他の用途に使っても良し
struct edge{
    int to,num;
};
vector<edge> G[MAX_V];
struct ED{
  int from,to;
};
ED P[MAX_V];

void input_graph(int E){
    int s,t;
    REP(i,E){
        cin>>s>>t;s--;t--;
        G[s].push_back({t,i});
        G[t].push_back({s,i}); //無向グラフの場合
        P[i]={s,t};
    }
}

//幅優先探索。引数は開始ノード。
void bfs(int root){
  queue<int> q;q.push(root);
  vector<bool> used(V,false);used.at(root)=true;
  depth[root]=0;

  while(!q.empty()){
    int now=q.front();q.pop();
    REP(i,G[now].size()){
      int next=G[now].at(i).to;
      if(!used.at(next)){
        used.at(next)=true;
        depth[next]=depth[now]+1; //距離の追加
        //ここに処理を追加
        q.emplace(next);
      }
    }
  }
}

//幅優先探索。引数は開始ノード。
void bfs2(int root){
  queue<int> q;q.push(root);
  vector<bool> used(V,false);used.at(root)=true;

  while(!q.empty()){
    int now=q.front();q.pop();
    REP(i,G[now].size()){
      int next=G[now].at(i).to;
      if(!used.at(next)){
        used.at(next)=true;
        val[next]+=val[now];
        q.emplace(next);
      }
    }
  }
}


int main(){
  cin>>V;E=V-1;
  input_graph(E);
  bfs(0);

  int q;cin>>q;
  REP(i,q){
    int t,e,x;cin>>t>>e>>x;e--;
    int st,en;
    if(t==1){
      st=P[e].from;
      en=P[e].to;
    }else{
      st=P[e].to;
      en=P[e].from;
    }
    //cout<<"st"<<st<<" "<<en<<endl;
    if(depth[st]<depth[en]){
      val[0]+=(ll)x;
      val[en]-=(ll)x;
    }else{
      val[st]+=(ll)x;
    }
  }

  bfs2(0);
  REP(i,V){
    cout<<val[i]<<endl;
  }
  return 0;
}
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<numeric>
#include<queue>


#define rep(i,p) for(long long int i=0;i<p;i++)
#define reep(i,p) for(long long int i=1;i<=p;i++)
#define ll long long
#define MOD 1000000007
#define INF 9223372036854775800

using namespace std;

ll int recal(ll int y, ll int x, ll int flag,vector< vector< bool > > bo,ll int A, ll int B,
		ll int H, ll int W){
	ll int ans = 0;
	if( flag == 0 ){
		if( A >= 1 ){
			if( bo[y][x] ){
				if( x != W-1 ){
					ans += recal(y,x+1,flag,bo,A,B,H,W);
					return ans;
				}
				else if( y != H-1 ){
					ans += recal(y+1,0,flag,bo,A,B,H,W);
					return ans;
				}
			}
			else{
				A-=1;
				bo[y][x] = true;
				ll int f=0;
				rep(i,H){
					rep(j,W){
						if( !bo[i][j] ){
							f = 1;
						}
					}
				}
				if( f == 0 ){
					return 1;
				}
			}
			if( x != W-1 ){
				ans += recal(y,x+1,0,bo,A,B,H,W);
				ans += recal(y,x+1,1,bo,A,B,H,W);
				ans += recal(y,x+1,2,bo,A,B,H,W);
			}
			else if( y != H-1 ){
				ans += recal(y+1,0,0,bo,A,B,H,W);
				ans += recal(y+1,0,1,bo,A,B,H,W);
				ans += recal(y+1,0,2,bo,A,B,H,W);
			}
		}
		else{
			return 0;
		}
	}
	else if( flag == 1 ){
		if( B >= 1 ){
			if( x == W-1 ){
				if( !bo[y][x] ){
					return 0;
				}
				else{
					ans += recal(y+1,0,flag,bo,A,B,H,W);
					return ans;
				}
			}
			else{
				if( bo[y][x] ){
					if( x != W-1 ){
						ans += recal(y,x+1,flag,bo,A,B,H,W);
						return ans;
					}
					else if( y != H-1 ){
						ans += recal(y+1,0,flag,bo,A,B,H,W);
						return ans;
					}
				}
				else{
					if( bo[y][x+1] ){
						return 0;
					}
					B -= 1;
					bo[y][x] = true;
					bo[y][x+1] = true;
					ll int f=0;
					rep(i,H){
						rep(j,W){
							if( !bo[i][j] ){
								f = 1;
							}
						}
					}
					if( f == 0 ){
						return 1;
					}
							
				}
				if( x != W-1 ){
					ans += recal(y,x+1,0,bo,A,B,H,W);
					ans += recal(y,x+1,1,bo,A,B,H,W);
					ans += recal(y,x+1,2,bo,A,B,H,W);
				}
				else if( y != H-1 ){
					ans += recal(y+1,0,0,bo,A,B,H,W);
					ans += recal(y+1,0,1,bo,A,B,H,W);
					ans += recal(y+1,0,2,bo,A,B,H,W);
				}
			}
		}
		else{
			return 0;
		}
	}
	else{
		if( B >= 1 ){
			if( y == H-1 ){
				return 0;
			}
			else{
				if( bo[y][x] ){
					if( x != W-1 ){
						ans += recal(y,x+1,flag,bo,A,B,H,W);
						return ans;
					}
					else if( y != H-1 ){
						ans += recal(y+1,0,flag,bo,A,B,H,W);
						return ans;
					}
				}
				else{
					if( bo[y+1][x] ){
						return 0;
					}
					B -= 1;
					bo[y][x] = true;
					bo[y+1][x] = true;
					ll int f=0;
					rep(i,H){
						rep(j,W){
							if( !bo[i][j] ){
								f = 1;
							}
						}
					}
					if( f == 0 ){
						return 1;
					}
							
				}
				if( x != W-1 ){
					ans += recal(y,x+1,0,bo,A,B,H,W);
					ans += recal(y,x+1,1,bo,A,B,H,W);
					ans += recal(y,x+1,2,bo,A,B,H,W);
				}
				else if( y != H-1 ){
					ans += recal(y+1,0,0,bo,A,B,H,W);
					ans += recal(y+1,0,1,bo,A,B,H,W);
					ans += recal(y+1,0,2,bo,A,B,H,W);
				}
			}
		}
		else{
			return 0;
		}
	}
	return ans;
}




			

					
			

int main(){

ll int H,W,A,B;
cin >> H >> W >> B >> A;

vector< vector< bool > > bo(H,vector< bool > (W,false) );
ll int ans = 0;

ans += recal(0,0,0,bo,A,B,H,W);
ans += recal(0,0,1,bo,A,B,H,W);
ans += recal(0,0,2,bo,A,B,H,W);

cout << ans << endl;








	return 0;

}

