#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=false;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}


// graph

///// dependency
/////

class Edge{
public:
    int from, to;
    long cost;

    Edge(int f, int t, long c){
        from = f;
        to = t;
        cost = c;
    }

    Edge(int f, int t){
        Edge(f, t, 1);
    }

    Edge(){
        Edge(INF, INF, 1);
    }

    bool operator<(const Edge &e) const{
        if(cost < e.cost){
            return true;
        }else if(cost > e.cost){
            return false;
        }else{
            if(from < e.from){
                return true;
            }else if(from > e.from){
                return false;
            }else{
                if(to < e.to){
                    return true;
                }else if(to > e.to){
                    return false;
                }else{
                    return false;
                }
            }
        }
    }

    bool operator==(const Edge &e) const{
        if(to == e.to && from == e.from && cost == e.cost){
            return true;
        }
        return false;
    }

    inline bool operator!=(const Edge& e) const{
        return !(*this == e);
    }
};

class Vertex{
public:
    int id; // 0-indexed
    long cost;

    bool visited;
    int from;
    long distance; // ここまでのパスの cost の合計

    Vertex(int i, long c, bool v, int f, long d){
        id = i;
        cost = c;
        visited = v;
        from = f;
        distance = d;
    }

    Vertex(int i, long c, bool v){
        Vertex(i, c, v, INF, INF);
    }

    Vertex(int i){
        Vertex(i, 0, false, INF, INF);
    }
    
    Vertex(){
        Vertex(INF, 0, false, INF, INF);
    }

    bool operator<(const Vertex &v) const{
        // cost で比較
        if(cost < v.cost){
            return true;
        }else if(cost > v.cost){
            return false;
        }else{
            if(id < v.id){
                return true;
            }else if(id > v.id){
                return false;
            }else{
                return false;
            }
        }
    }

    bool operator==(const Vertex &v) const{
        if(cost == v.cost && id == v.id){
            return true;
        }
        return false;
    }

    inline bool operator!=(const Vertex& v) const{
        return !(*this == v);
    }

    void reset_vertex(){
        distance = 0;
        visited = false;
        from = INF;
    }
};

class Graph{
public:
    int number_of_vertice;
    int number_of_edges;
    vector<Vertex> vertice;
    vector<vector<Edge>> edges; // 隣接リスト

    void reset(){
        for(auto &vertex : vertice){
            vertex.reset_vertex();
        }
    }

    vector<Edge> next(int vertex_id){
        // 隣接枝リストを返す
        return edges[vertex_id];
    }
};

void dfs(Graph& graph, int start){
    vector<Edge> next_edges = graph.next(start); // 接続先
    for(auto edge : next_edges){
        if(graph.vertice[edge.to].visited == false){
            graph.vertice[edge.to].visited = true;
            graph.vertice[edge.to].from = start;
            graph.vertice[edge.to].distance = graph.vertice[start].distance + edge.cost + graph.vertice[edge.to].cost;
            dfs(graph, edge.to);
        }
    }
}


void answer(){
    Graph graph;
    int from, to;

    int Q;
    cin>>graph.number_of_vertice>>Q;
    graph.number_of_edges = graph.number_of_vertice - 1;
    graph.vertice.resize(graph.number_of_vertice);
    graph.edges.resize(graph.number_of_vertice);
    
    // init vertex
    for(int i=0; i<graph.number_of_vertice; i++){
        graph.vertice[i] = Vertex(i, 0, false);
        //graph.vertice[i].id = i;
        //graph.vertice[i].cost = 0;
        //graph.vertice[i].visited = false;
        debug("id", i, graph.vertice[i].id, graph.vertice[i].cost, graph.vertice[i].visited, Vertex(i, 0, false).id);
        graph.edges[i] = vector<Edge>();
        debug("id", i, graph.vertice[i].id);
    }
    graph.reset();
    
    // init edge
    for(int i=0; i<graph.number_of_edges; i++){
        cin>>from>>to;
        // 入力される値の範囲, 0-indexed ?
        from--;
        to--;
        debug("from", from, graph.vertice[from].id);
        debug("to", to, graph.vertice[to].id);
        graph.edges[from].push_back(Edge(from, to, 0));
        graph.edges[to].push_back(Edge(to, from, 0)); // 無向
    }

    for(int i=0; i<Q; ++i){
        int p, x;
        cin>>p>>x;
        graph.vertice[p-1].cost += x;
    }

    // dfs
    for(int i=0; i<graph.number_of_vertice; ++i){
        debug(graph.vertice[i].visited);
        if(graph.vertice[i].visited == false){
            graph.vertice[i].visited = true;
            graph.vertice[i].distance = graph.vertice[i].cost;
            debug(graph.vertice[0].visited, graph.vertice[1].visited, graph.vertice[2].visited, graph.vertice[3].visited);
            dfs(graph, i);
        }
    }

    for(int i=0; i<graph.number_of_vertice; ++i){
        cout<<graph.vertice[i].distance<<" ";
    }
    cout<<endl;

    return;
}

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


Measured memory_bytes: 45568