#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;



    class Edge{
    public :
        long long int pt1;
        long long int pt2;

        Edge(){
            pt1 = 0;
            pt2 = 0;
        }
        Edge(long long  int a,long long int b){
            pt1 = a;
            pt2 = b;
        }
    };


    void solve(vector<Edge> graph, long long int count[], long long int p, long long int x){
        list<long long int> nodes;
        nodes.push_back(p);
        long long int a;
        while(!nodes.empty()){
            a = nodes.front();
            // cout << a << endl;
            nodes.pop_front();
            count[a-1] += x;

            for (auto it = graph.begin(); it != graph.end(); it++){
                if( (*it).pt1 == a ){
                    nodes.push_back((*it).pt2);
                }
            }
        }
        // for (int i =0; i < graph.size()+1; i++){
        //     cout << count[i] << " ";
        // }cout <<endl;
        return;
    }

    int main(){
        long long int n;
        long long int q;
        vector<Edge> graph;
        
        cin >> n;
        cin >> q;
        long long int count[n] = {0};
        long long int a,b;
        
        for ( long long int i = 0; i < n-1; i++ ){
            cin >> a >> b;
            graph.push_back(Edge(a,b));
        }


        // cout << "\n";
        // for (auto it = graph.begin(); it != graph.end(); it++){
            // cout << (*it).pt1 << " " << (*it).pt2 << "\n";
        // }
        // cout << "\n";

        long long int p,x;
        for (long long int i = 0; i < q; i++){
            cin >> p >> x;
            solve(graph,count,p,x);
        }
        for (long long int i = 0; i < n; i++){
            cout << count[i] << " ";
        }
        return 0;
    }