#include #include using namespace std; using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define endl "\n" #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } // 区間加算・区間和取得 struct S { long long value; int size; }; using F = long long; S op(S a, S b) { return { a.value + b.value, a.size + b.size }; } S e() { return { 0, 0 }; } S mapping(F f, S x) { return { x.value + f * x.size, x.size }; } F composition(F f, F g) { return f + g; } F id() { return 0; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector>> to(n); rep(i, n - 1) { int u, v, w; cin >> u >> v >> w; to[u].emplace_back(v, w); to[v].emplace_back(u, w); }int timer = 0; vectortmp(2 * n); vectorweight(n), in(n), out(n); auto dfs = [&](auto self, int v, int p = -1)->void { tmp[timer] = { weight[v], 1 }; in[v] = timer; timer++; for (auto e : to[v]) { if (p == e.first)continue; weight[e.first] = e.second; self(self, e.first, v); } tmp[timer] = { -weight[v], -1 }; out[v] = timer; timer++; }; dfs(dfs, 0); lazy_segtree seg(tmp); int q; cin >> q; while (q--) { int t; cin >> t; if (1 == t) { int v, x; cin >> v >> x; seg.apply(in[v] + 1, out[v], x); } else { int v; cin >> v; auto ans = seg.prod(0, in[v] + 1); cout << ans.value << endl; } } return 0; }