n,q=gets.split.map(&:to_i)
$quearray=[]
$parentArray=[]
$addArray=[]

n.times{
    $addArray<<0
}

n.times{
   $parentArray<<-1
}

n.times{
    $quearray<<[]
}


(n-1).times{
    a,b=gets.split.map(&:to_i)
    $quearray[a-1]<<b
    $quearray[b-1]<<a
}

def searchChild(a,parent)
    $parentArray[a-1]=parent
    
    $quearray[a-1].map{|i| 
        
        if $parentArray[i-1]==-1
            searchChild(i,a)
        end
    }
end

def searchParent(node,score)
    myParent=$parentArray[node-1]
    if myParent==0
        return score+$addArray[node-1]
    else
        return searchParent(myParent,score+$addArray[node-1])
    end
end

searchChild(1,0)

q.times{
    p,x=gets.split.map(&:to_i)
    $addArray[p-1]+=x
}

answerArray=[]

n.times{|i|
    answerArray<<searchParent(i+1,0)
}



puts answerArray.join(' ')