//bismillahir rahmanir rahim            //Author:Fayed Anik
 
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
/*
template <typename T>  using ordered_set =
    tree<T, null_type, less<T>,   /// greater<T> for sorting decreasingly
    rb_tree_tag, tree_order_statistics_node_update>;
*/

#define         ll                          long  long
#define         lf                          double
#define         pb(x)                       push_back(x)
#define         ull                         unsigned long long
#define         sfl(a)                      scanf("%lld",&a)
#define         sf(a)                       scanf("%d",&a)
#define         pf(a)                       printf("%d\n",a)
#define         pfl(a)                      printf("%lld\n",a)
#define         FOR(x,n)                    for(ll x=1;x<=n;++x)
#define         pii                         pair< ll , ll >
#define         mp(a,b)                     make_pair(a,b)
#define         mod                         1000000007
#define         INF                         2e18
#define         f1                          first
#define         f2                          second
#define         all(v)                      v.begin(),v.end()
#define         PI                          acos(-1)
#define         printminusone               printf("-1\n")
#define         bug                         printf("bug")
#define         FILEIN                      freopen("in.txt","r",stdin)
#define         FILEOUT                     freopen("out.txt","w",stdout)
 
//ll SET(ll mask,ll pos){ return mask = (mask | (1ll<<pos)); }
//ll RESET(ll mask,ll pos){ return mask = mask & ~(1ll<<pos); }
//bool CHECK(ll mask,ll pos) { return (bool) (mask & (1ll<<pos)); }
//priority_queue <ll, vector<ll>, greater<ll> > pq;

#define N 200005

vector<ll>edge[200005];

ll tim[N],tot[N],tree[4*N],lazy[4*N],t=1,ans[N];

void dfs(ll u,ll par){
    tim[u]=t;
    t++;
    for(auto v:edge[u]){
        if(v!=par){
            dfs(v,u);
            tot[u] += (1+tot[v]);
        }
    }
}

void pushup(ll nd,ll b,ll e){
    if(b!=e){
        lazy[2*nd] += lazy[nd];
        lazy[2*nd+1] += lazy[nd];
    }
    else{
        tree[nd] += lazy[nd];
    }
    lazy[nd]=0;
}

void update(ll nd,ll b,ll e,ll i,ll j,ll val){
    if(lazy[nd]){
        pushup(nd,b,e);
    }
    if(i>e or j<b) return;
    if(b>=i and e<=j){
        lazy[nd]=val;
        return;
    }
    ll mid=(b+e)/2;
    update(2*nd,b,mid,i,j,val);
    update(2*nd+1,mid+1,e,i,j,val);
    tree[nd] = tree[2*nd]+tree[2*nd+1];
}

ll get(ll nd,ll b,ll e,ll i){
    if(lazy[nd]){
        pushup(nd,b,e);
    }
    if(i>e or i<b) return 0;
    if(i==e and i==b) return tree[nd];
    ll mid=(b+e)/2;
    return get(2*nd,b,mid,i)+get(2*nd+1,mid+1,e,i);
}
int main(){
   ll n,q,u,v;
   sfl(n),sfl(q);
   for(ll i=1;i<n;i++){
       sfl(u),sfl(v);
       edge[u].pb(v);
       edge[v].pb(u);
   }
   dfs(1,1);
   FOR(cs,q){
       sfl(u),sfl(v);
       update(1,1,n,tim[u],tim[u]+tot[u],v);
   }
   for(ll i=1;i<=n;i++){
       ans[i]=get(1,1,n,tim[i]);
       //printf("%lld ",get(1,1,n,i));
   }
   for(ll i=1;i<=n;i++){
       printf("%lld ",ans[i]);
   }
   return 0;
}


Measured memory_bytes: 39680