#include using namespace std; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a struct FixPoint : F{ FixPoint(F&& f):F(forward(f)){} template decltype(auto) operator()(Args&&... args) const{ return F::operator()(*this,forward(args)...); } }; template inline decltype(auto) MFP(F&& f){ return FixPoint{forward(f)}; } //INSERT ABOVE HERE signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n,q; cin>>n>>q; vector> G(n); for(int i=1;i>a>>b; a--;b--; G[a].emplace_back(b); G[b].emplace_back(a); } using ll = long long; vector vs(n,0); for(int i=0;i>x>>y>>z; x--; cout<void{ vs[v]+=z; if(d==y) return; for(int u:G[v]) if(u!=p) dfs(u,v,d+1); })(x,-1,0); } return 0; }