/**
*    author:  ekusiadadus
*    created: 03.01.2021 14:00:37
**/

#pragma region Macros
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
using ll = long long;

#define rep(i,n) for(int i = 0; i < (n); i++)
#define repn(i,n) for(int i = 1; i <= (n); i++)
#define pb push_back
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}
template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}

const double PI = acos(-1);
const int mod = 1000000007;
class mint {
  long long x;
  public:
  mint(long long x=0) : x((x%mod+mod)%mod) {}
  mint operator-() const {
    return mint(-x);
  }
  mint& operator+=(const mint& a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const  mint& a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint& a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint& a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint& a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    return a;
  }
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint& a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint& a) const {
    mint res(*this);
    return res/=a;
  }

  friend ostream& operator<<(ostream& os, const mint& m){
    os << m.x;
    return os;
  }
};
#pragma endregion

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  int n;
  cin >> n;
  vector<int> a(n-1), b(n-1);
  vector<vector<int>> g(n);
  for(int i = 0; i < n-1; ++i){
    cin >> a[i] >> b[i];
    a[i]--,b[i]--;
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  vector<int> p(n,-1);
  vector<vector<int>> ch(n);
  queue<int> q;
  q.push(0);
  vector<int> bfs;
  while(!q.empty()){
    int v = q.front();
    q.pop();
    bfs.push_back(v);
    for(int w:g[v]){
      if(w!=p[v]){
        p[w] = v;
        ch[v].push_back(w);
        q.push(w);
      }
    }
  }
  int t;
  cin >> t;
  ll sum = 0;
  vector<ll> c(n,0);
  while(t--){
    int t,e,x;
    cin >> t >> e >> x;
    e--;
    int a1,b1;
    if(t == 1){
      a1 = a[e];
      b1 = b[e];
    }else{
      a1 = b[e];
      b1 = a[e];
    }
    if(b1 == p[a1]) c[a1] += x;
    else{
      sum += x;
      c[b1] -= x;
    }
  }
  for(int v:bfs){
    for(int w:ch[v]){
      c[w] += c[v];
    }
  }
  for(int i = 0; i < n; ++i){
    cout << sum + c[i] << endl;
  }
  return 0;
}
#include <bits/stdc++.h>

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
typedef long long LL;

const int MAXN = 2E5 + 5;
const int MOD = 1E9 + 7;
int n, m, k;
LL x[MAXN], y[MAXN];
LL mixh[MAXN], miyh[MAXN];
LL ans = 0;

template <class T>
void read(T& x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
    while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}

template <class T, class... Args>
void read(T& x, Args&... args) {
    read(x), read(args...);
}

template <class T>
void write(T x) {
    if (x < 0) putchar('-'), x = -x;
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

#define lid id << 1
#define rid id << 1 | 1

struct node {
    int l, r;
    LL sum;
} tr[MAXN << 2];

void update(int id) { tr[id].sum = tr[lid].sum + tr[rid].sum; }

void build(int id, int l, int r) {
    tr[id].l = l, tr[id].r = r;
    if (l == r) {
        tr[id].sum = 1;
        return;
    }
    int mid = l + r >> 1;
    build(lid, l, mid);
    build(rid, mid + 1, r);
    update(id);
}

int query(int id, int l, int r) {
    if (tr[id].l == l && tr[id].r == r) return tr[id].sum;
    int mid = tr[id].l + tr[id].r >> 1;
    if (r <= mid)
        return query(lid, l, r);
    else if (l > mid)
        return query(rid, l, r);
    else
        return query(lid, l, mid) + query(rid, mid + 1, r);
}

void modify(int id, int x) {
    if (tr[id].l == x && tr[id].r == x) {
        tr[id].sum = 0;
        return;
    }
    int mid = tr[id].l + tr[id].r >> 1;
    if (x <= mid)
        modify(lid, x);
    else
        modify(rid, x);
    update(id);
}

vector<int> s[MAXN];

signed main() {
    // freopen("1.in", "r", stdin);
    ios::sync_with_stdio(false);
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) mixh[i] = m + 1;
    for (int i = 1; i <= m; i++) miyh[i] = n + 1;
    for (int i = 1; i <= k; i++) {
        cin >> x[i] >> y[i];
        mixh[x[i]] = min(mixh[x[i]], y[i]);
        miyh[y[i]] = min(miyh[y[i]], x[i]);
        s[x[i]].push_back(y[i]);
    }
    for (int i = 1; i < miyh[1]; i++) ans += mixh[i] - 1;
    for (int i = 1; i < mixh[1]; i++) ans += miyh[i] - 1;
    // cout << ans << endl;
    build(1, 1, m + 2);
    for (int i = 1; i < miyh[1]; i++) {
        ans -= query(1, 1, min(mixh[i] - 1, mixh[1] - 1));
        for (auto& y : s[i]) modify(1, y);
    }
    cout << ans;
    return 0;
}