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

int64_t dp[305][13];

int64_t solve (int n,int i) {
	if (i == 11 and n > 0) return 1;
	if (n <= 0 or i >= 11) return 0;
	if (dp[n][i] != -1) return dp[n][i];
	int64_t res = 0;
	for (int j = 1; j <= n; ++j) {
		res += solve(n - j,i + 1);
	}
	return dp[n][i] = res;
}

int main () {
	 ios::sync_with_stdio(false);
	 cin.tie(nullptr);
	 cout.tie(nullptr);
	 int T = 1;
	 //~ cin >> T;
	 for (int test_case = 1; test_case <= T; ++test_case) {
		 int n;
		 cin >> n;
		 memset(dp,-1,sizeof(dp));
		 cout << solve (n,0);
	 }
	 //cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

ll n, q;
pll edgeList[200005];
pair<int, pll> query[200005];
ll segtree[800005] = {0};
pll range[200005];
ll newID[200005], step = 0;
vector<int> edge[200005];
ll val[200005] = {0};
ll lazy[800005] = {0};
ll sz[200005] = {0};
int indexOf[200005] = {0};

void reset()
{
}

void input()
{
	cin >> n;
	UP(i, 1, n)
	{
		cin >> edgeList[i].fi >> edgeList[i].se;
		edge[edgeList[i].fi].pb(edgeList[i].se);
		edge[edgeList[i].se].pb(edgeList[i].fi);
	}
	cin >> q;
	UU(i, 1, q) cin >> query[i].fi >> query[i].se.fi >> query[i].se.se;
}

void update(int idx, int l, int r, int tl, int tr, ll addVal)
{
	int m = l + r >> 1;
	if(lazy[idx])
	{
		ll add = lazy[idx] / (r - l + 1);
		segtree[idx] += lazy[idx];
		if(l != r)
		{
			lazy[idx * 2] += add * (m - l + 1);
			lazy[idx * 2 + 1] += add * (r - m);
		}
		lazy[idx] = 0;
	}
	if(l > tr || r < tl) return ;

	if(tl <= l && r <= tr)
	{
		segtree[idx] += addVal * (r - l + 1);
		if(l != r)
		{
			lazy[idx * 2] += addVal * (m - l + 1);
			lazy[idx * 2 + 1] += addVal * (r - m);
		}
		return ;
	}

	update(idx * 2, l, m, tl, tr, addVal);
	update(idx * 2 + 1, m + 1, r, tl, tr, addVal);
	segtree[idx] = segtree[idx * 2] + segtree[idx * 2 + 1];
}

void build(int idx, int l, int r)
{
	int m = l + r >> 1;
	if(lazy[idx])
	{
		ll add = lazy[idx] / (r - l + 1);
		segtree[idx] += lazy[idx];
		if(l != r)
		{
			lazy[idx * 2] += add * (m - l + 1);
			lazy[idx * 2 + 1] += add * (r - m);
		}
		lazy[idx] = 0;
	}
	if(l == r)
	{
		val[l] = segtree[idx];
		return ;
	}
	build(idx * 2, l, m);
	build(idx * 2 + 1, m + 1, r);
}
void solve()
{
	UU(i, 1, q)
	{
		ll a = newID[edgeList[query[i].se.fi].fi];
		ll b = newID[edgeList[query[i].se.fi].se];
		ll sa = sz[a];
		ll sb = sz[b];
		
		if(query[i].fi == 1)
		{
			if(sa < sb)
			{
				update(1, 1, n, range[a].fi, range[a].se, query[i].se.se);
			}
			else
			{
				update(1, 1, n, 1, n, query[i].se.se);
				update(1, 1, n, range[b].fi, range[b].se, -query[i].se.se);
			}
		}
		else
		{
			if(sb < sa)
			{
				update(1, 1, n, range[b].fi, range[b].se, query[i].se.se);
			}
			else
			{
				update(1, 1, n, 1, n, query[i].se.se);
				update(1, 1, n, range[a].fi, range[a].se, -query[i].se.se);
			}
		}
	}
}


int dfs(int now, int prev)
{
	newID[now] = ++step;
	indexOf[step] = now;
	range[newID[now]].fi = step;
	sz[newID[now]] = 1;

	UP(i, 0, edge[now].size())
	{
		if(edge[now][i] != prev)
		{
			sz[newID[now]] += dfs(edge[now][i], now);
		}
	}

	range[newID[now]].se = step;
	return sz[newID[now]];
}

void LetsRock()
{
	UU(i, 1, n)
	{
		if(edge[i].size() == 1)
		{
			dfs(i, i);
			break;
		}
	}
	solve();
	build(1, 1, n);
	ll ans[200005] = {0};
	UU(i, 1, n)
		ans[indexOf[i]] = val[i];

	UU(i, 1, n) cout << ans[i] << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

		reset();
		input();
		LetsRock();

	return 0;
}
