/*
    QQgBgIPPPqPKPqPKPKqqqKPKPqPqPqPKPqK1BBBB2JXKPqPKPqPKPPPKPKPPPPPqPPPKPKPKPqPqPqPqPPPKPqPPPqPqPqPqPqPKPqPKPqPKPqPqPKPqPqPPPqPqPKPqPPPPPPPqPqPqPqPqq2
   Rr  .Bvs1u1uuJjLL77r7r77vvJJuuUuUju7ds  uB57vYujuJususjJujuJ1s1J1Juj1jUuususuJjJujuuUuU12u1u1j1jUuuJuJuJjJujujuJ1uUuUu1u1j1jUu2u2uU12uU1Uu1usvssuYE
7K::   UE           ..::::..           Bi   irg
bM  ..  7U     :rJJuYJvLvYLjJj7i     .U7  .   MS7. Yrrrr7qrirrr7r7rrrrrL   7Prr7rrr7ri.        ..    1Jirrr7rrrrrrru     .:ii:.                .BvLD.
  777IP.  7PvKP1vi:::.:...:::i7Yqb2rKi  .qsgZIJ:LQ:Bir7iBrBrr77rirjuYr7B    QZiir7Y7rvPQi  .isBBBBQ7::BJrr7rrrJuJr:B  7EP1svLY5bE.        .ruSRQDBRv
       Yv:uRJi:::::rvJJ1uuL7i:::::7PQ: js  5Z.:i.M1D.i:iQ SX.i::PbJsuqbB    iB.:1Mr5bi.iBi  .sBMZRBi  7Q.i::5duYjK5B PDi:::ii:::7Br     7dS2PZv. i
        MB7.i::i1KPIjv7r77sUqPS7::i:i2Bi   Jg:ii:JBJ:ii7B ud::iBv     :K    rB::Zu  .B:.DS     KEs    iB:i:MU     .vXQ.iirDJq2:i:rB   UMI:5Dr
       B1:ii:iSdv.           .iSbv.ii::BJ  LQ:irii5iir:Ig vR::EK            iB.:d5   Bi:Z1  iPPdPbqI. .B::1B        Ib:i:B7  BYiiiQ  BK:iBs
      BL:rr:7D7  ...::i:i::::.  .qP:iii:BJ rB:rrriiirriqP rQ::MY            rB::Z5   Br:gr QBQDbbbMQBY.B::XZ        SEiiiB.  DX:iiQ Bv:rB.
     BU:iriUBBDBBBQBBBBBQBQBBBBBQgQBrrri:B .Qir7r7r7rr:D2 iB::gJ            rB::D5   Br:dsSBS PbPZ7 gQUR:iSD        Sgir:B. .BbPqPBBLi:B.       ..
    .BvIKS1XPISUusYvYLsLJLsLYLuU5SXZJUX5jbS.R:7777777rigJ :Bi:RL  :IB.      7BiigI   B7:g7JQJ PPbdi gMYRiiKE  :sBi  XgiriB. ...   :B:iuB  .QBi7ZdKBi
  :qBb7i.  s::.        .         ..iv  :rJZBBvrv777v77iBv .Bir1BQBguB       7BirgI   B7iM7 1QXPbqb5PM7 BirvBBBQjQ:  5Ri7iB.       .BirvEgQM5vXgQqBsB
  ..DgJ2S1Br    LXPJ.      rKPI:    BqK5IsRjMrv7Lvv7v7rBv .BrrZX.rSQB       vBrrRs   BviQU  QZdKqqdgM  BrrSg.iIZB.  5Mr7rQ.        Brrug:iYBdgBu1Bqb
    iBi777gP  PBBBBBQB   7BBBBQBB  .B777ruK:Dr7LvYvYvLrB7 .BrrQ7   .Z       LBrrgX .PErYQi :KgPPKPbZ2  B7rdb    d.  2Qrv7B  igJ1J1LBv7vB   qJBIjBQZ
     BU7YvvB. BBBQBBBB   ZBBBBBBB. BK7Lv7B.iR7YvYvYvYv7QL .B7rBY            uB77JqMMZ5RQ7   igdKqqZM   Qv7EE        5Q777B   BDUIPQ:B77M5    BEJB1PR
     iBsLYv1B: UQBBBB. .  2BBBBQ. gg7sLvMQ KZvLJv7LJsJ7Bj .B77Qv            1B7LJgIKSui     PRZPKdgQ:  Bv7Dd        uQ7YvB   MPvvIB 2BLvQ7    bZPBUBB
      7B1vjvjQ2       BBB       :QqvJYvgB  MdvjvSBLYjsvRS .Bvvgd            KQLvDE           .RPPdE    BYvKB        5QvYLB:  BjLs2B  sBqsQS   ERLBBBBY
       .BQJJss5RXr     :.    :YgbJYuLKQB   B5JsvgBdLJjLgb .BvjLB5.    sB    qRvYMK            QZPMI    BLjLRE.    iQqBvus2gbMIsjYbB   .ZBZQQ.UBrBr
      .vrrMM5YYv5QBUg7Sruud5SBdYvLjPBI.i1. BUsjvB RXuJJqR iBvsjLdMMDgMBB    gEYvQU            QMgR7   .QssuLPggEDgRB gBI1su1usuJEB:      JbPBgvZb
 rYJYbU   1JvdPDM21BBRQ.:Q5BBEEZqEPivr   rBBbEIKBi BPEPZB:RqjI22UKEDZdQB   iQgbERB:        iv1E2LMZ: :BBPEPqj22SXI2B  rggDPPqEDQd          RDYIBQBQv
Bu      ur  :BUPJBZ...r..r. .QMXZbE.  Jv  7:..Bi:: .i:::iPBDgPdBgv:...:.   i:....:iiRQBPgrrr.     .r:7r::::rBRbgKQBr     .rrr:.           QE:Q7 bLLY
rj7j   sBPgB5BDBBBB1       .gBBBBBBBBgMBJ    :Q2uZBgDgEDbBBBBBBbbqugXX2SDQDbZgDgDgDBBBBBBBDDgQEgdPSXggZgEDdBBBQBdgSPQBRPUISPPEEQBBBBQMDBBBuBBBdMggDgBB
   QI.:MBBJBBUIv7rvPZ1YYsv5D57v77v12jZBZBBDBBBBQB2JJ1J1JJ777vj1jEgBBBDdBQgBBJs1JuJjvv7YuUIQBBZQQQQBQIYuJusjvv7vY5jMQgQRBBXvii:iiiirvbBBMIBRuJ7JJJsjJ1Y
    .bBBdvBI                           :sXQBPBMZi                 :IbPBQbMu                :jPBEQQg:               .1ZDBqUXs:r:::7iPI2QBXi
       7jrP                                                                                                             :LSJPQXUBbsP7:                                                                                                    .. :2:K.:7
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef double db;
/* Nothing is ture, (22)
Everything is permitted*/
#define fi  first
#define se second
#define pb(x)       push_back(x)
#define mp(a,b)  make_pair(a,b)
#define sz(a)  ((int)(a).size())
#define all(x) x.begin(),x.end()
#define msort(a) sort(a+1,a+1+n);
#define endl "\n"

#define ff(i,a,b) for(ll i=a;i<=b;++i)

#define de(a) cout << #a << " = " << a << endl;
#define dd(a) cout << #a << " = " << a << "  ";

#define INF 0x3f3f3f3f
#define INFF 0x3f3f3f3f3f3f3f3f
#define mem(a,b)   memset(a,b,sizeof(a))
#define file freopen("in.txt","r",stdin)
#define jkl ios::sync_with_stdio(false);cin.tie(0);
/*********************************************/
const int N=2e5+5;
bool vis[N];
int ans[N];
int num[N];
vector<int> v[N];
void dfs(int now,int val) {
	vis[now]=true;
	ans[now]=val;
	for(auto i:v[now]) if(vis[i]==false) {
		vis[i]=true;
		dfs(i,val+num[i]);
	}
}
		
int main() {
	int n,q;
	cin >> n >> q;
	ff(i,1,n-1) {
		int q1,q2;cin >> q1 >> q2;
		v[q1].pb(q2);
		v[q2].pb(q1);
	}
	ff(i,1,q) {
		int q1,q2;
		cin >> q1 >> q2;
		num[q1]+=q2;
	}
	dfs(1,num[1]);
	ff(i,1,n) cout << ans[i] << ' ';
}

Measured memory_bytes: 21376