	#include <bits/stdc++.h>
	#define rep(i,n) for(int i = 0; i < (n); ++i)
	using namespace std;
	using ll = long long;
	using P = pair<int,int>;

	int N;
	vector<vector<int>> es;
	vector<int> A, B;

	vector<int> depth;
	vector<ll> dp;

	void DepthDFS(int a, int d) {
		depth[a] = d;
		for (int next : es[a]) {
			if (depth[next] == -1) {
				DepthDFS(next, d + 1);
			}
		}
	}

	void ImosDFS(int a, long now) {
		now += dp[a];
		dp[a] = now;
		for(int next : es[a]) {
			if (depth[next] > depth[a]) {
				ImosDFS(next, now);
			}
		}
	}

	int main() {
		cin >> N;
		es.resize(N);
		A.resize(N - 1);
		B.resize(N - 1);
		depth = vector<int>(N, -1);
		dp = vector<ll>(N, 0);

		rep(i, N - 1) {
			cin >> A[i] >> B[i];
			A[i]--; B[i]--;
			es[A[i]].push_back(B[i]);
			es[B[i]].push_back(A[i]);
		}

		DepthDFS(0, 0);

		int Q;
		cin >> Q;
		rep(i, Q) {
			int t, e, x;
			cin >> t >> e >> x;
			e--;

			int va, vb;
			if (t == 1) {
				va = A[e];
				vb = B[e];
			}
			else {
				va = B[e];
				vb = A[e];
			}

			if (depth[va] < depth[vb]) {
				dp[0] += x;
				dp[vb] -= x;
			}
			else {
				dp[va] += x;
			}
		}

		ImosDFS(0, 0);
		
		rep(i, N)cout << dp[i] << endl;

	}
	






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

template <class A, class B> bool cmin(A& a, B b) { return a > b && (a = b, true); }
template <class A, class B> bool cmax(A& a, B b) { return a < b && (a = b, true); }

template <typename T> class Dijkstra {
private:
  struct edge {
    int to;
    T cost;
  };
  vector<vector<edge>> G;
  vector<T> D;

public:
  Dijkstra(int n) : G(n), D(n, numeric_limits<T>::max()) {}
  void add(int from, int to, T cost) {
    G.at(from).push_back((edge){to, cost});
    G.at(to).push_back((edge){from, cost});
  }
  vector<T> solve(int start) {
    using pti = pair<T, int>;
    priority_queue<pti, vector<pti>, greater<pti>> Q;
    D.at(start) = 0;
    Q.push(pti(0, start));
    while (Q.size()) {
      auto [dist, now] = Q.top();
      Q.pop();
      if (D.at(now) < dist) continue;
      for (auto [next, cost] : G.at(now)) {
        if (D.at(next) > D.at(now) + cost) {
          D.at(next) = D.at(now) + cost;
          Q.push(pti(D.at(next), next));
        }
      }
    }
    return D;
  }
  void reset() { fill(D.begin(), D.end(), numeric_limits<T>::max()); }
};

signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);

  int N;
  cin >> N;
  vector<pair<int, int>> V(N - 1);
  vector<vector<int>> G(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b, a--, b--;
    V.at(i) = {a, b};
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  
  Dijkstra<int> D(N);
  for (const auto& [a, b] : V) D.add(a, b, 1);
  auto rank = D.solve(0);
  vector<long> cnt(N);

  int Q;
  cin >> Q;
  while (Q--) {
    int t, e, x;
    cin >> t >> e >> x, e--;
    auto [a, b] = V.at(e);
    if (t == 1) {
      if (rank.at(a) < rank.at(b)) {
        cnt.at(0) += x;
        cnt.at(b) -= x;
      } else {
        cnt.at(a) += x;
      }
    } else {
      if (rank.at(a) < rank.at(b)) {
        cnt.at(b) += x;
      } else {
        cnt.at(0) += x;
        cnt.at(a) -= x;
      }
    }
  }

  auto dfs = [&](auto&& dfs, int now, int pre) -> void {
    for (const auto& next : G.at(now)) {
      if (next == pre) continue;
      cnt.at(next) += cnt.at(now);
      dfs(dfs, next, now);
    }
  };

  dfs(dfs, 0, -1);

  for (const auto& a : cnt) cout << a << '\n';
}