#include <bits/stdc++.h>
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define REPS(i, ss, nn ) for(int i = ss ; i < (int) nn; i++)
#define REV(i, ss, nn ) for(int i = ss ; i >= nn; i--)
#define deb(x) std::cout << #x << " " << x << endl;
#define debl(x) std::cout << #x << " " << x << " ";
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
namespace std{
    template<class Fun>
    class y_combinator_result{
        Fun fun_;
        public:
            template<class T>
            explicit y_combinator_result(T &&fun) : fun_(std::forward<T>(fun)){}
            template<class ...Args>
            decltype(auto) operator()(Args&&...args){
                return fun_(std::ref(*this), std::forward<Args>(args)...);
            }
    };
    template<class Fun>
    decltype(auto) y_combinator(Fun && fun){
        return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
    }
};
template<typename T>
bool u_max(T& a, T b){
    if( a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
bool u_min(T& a, T b){
    if( a > b){
        a = b;
        return true;
    }
    return false;
}
struct edge{
    int to, from;
    // ll cost;
    edge(){ edge(0,0);}
    // edge(int to_, ll cost_){ edge(to_, -1, cost_);}
    // edge(int to_, int from_, ll cost_) : to(to_), from(from_), cost(cost_){}
    edge(int to_, int from_) : to(to_), from(from_){};
};

template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}

void dfs(int node, int par, vector<vector<int>>& adj, vector<int>& parent){
    parent[node] = par;
    for(const auto & vert : adj[node]){
        if(vert == par) continue;
        dfs(vert, node, adj, parent);
    }
}

void summary(int node, int par, ll acc, vector<vector<int>>& adj, vector<ll>& add, vector<ll>& results){
    results[node] += acc;
    for(const auto & vert : adj[node]){
        if(vert == par) continue;
        summary(vert, node,  acc + add[vert], adj, add, results);
    }
}

void solve(){
    int n;
    read(n);
    vector<edge> edges(n);
    vector<vector<int>> adj(n);
    REP(i, n - 1){
        int a, b;
        read(a, b);
        a--; b--;
        edges[i].from = a;
        edges[i].to = b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    vector<int> parent(n, -1);
    int root = 0;
    dfs(root, -1, adj, parent);
    // cout << "dfs done" << endl;
    vector<ll> add(n);
    int q;
    read(q);
    REP(i, q){
        int t, e, x;
        read(t,e, x);
        e--;
        int a = edges[e].from;
        int b = edges[e].to;
        if(t == 2){
            swap(a, b);
        }
        //apply left a but not right b
        if( a == parent[b]){
            add[root] += x;
            add[b] -= x;
        }else{
            add[a] += x;
        }
    }
    vector<ll> results(n);
    summary(root, -1, add[0], adj, add, results);
    REP(i, n){
        cout << results[i] << "\n";
    }
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back

int n,query,i,a[200010],b[200010],dis[200010],c[200010],e,x,s,t;
bool vis[200010];
vector<int> adj[200010];
queue<int> q;

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n;
	for (i=1;i<n;i++) cin>>a[i]>>b[i];
	for (i=1;i<n;i++) {adj[a[i]].pb(b[i]);adj[b[i]].pb(a[i]);}
	
	for (i=1;i<n+1;i++) vis[i]=false;
	dis[1]=0;vis[1]=true;q.push(1);
	while (!q.empty())
	{
		s=q.front();q.pop();
		for (auto u:adj[s])
		{
			if (vis[u]) continue;
			vis[u]=true;
			dis[u]=dis[s]+1;
			q.push(u);
		}
	}
	
	for (i=1;i<n+1;i++) c[i]=0;s=0;
	cin>>query;
	for (i=1;i<query+1;i++)
	{
		cin>>t>>e>>x;
		if (t==2) swap(a[e],b[e]);
		if (dis[a[e]]>dis[b[e]]) c[a[e]]=c[a[e]]+x;
		else
		{
			s=s+x;c[b[e]]=c[b[e]]-x;
		}
		if (t==2) swap(a[e],b[e]);
	}
	
	t=s;
	
	for (i=1;i<n+1;i++) vis[i]=false;
	dis[1]=c[1];q.push(1);vis[1]=true;
	while (!q.empty())
	{
		s=q.front();q.pop();
		for (auto u:adj[s])
		{
			if (vis[u]) continue;
			vis[u]=true;
			dis[u]=dis[s]+c[u];
			q.push(u);
		}
	}
	for (i=1;i<n+1;i++) dis[i]=dis[i]+t;
	for (i=1;i<n+1;i++) cout<<dis[i]<<"\n";
}