// Original C++ solution (slower):
#include <cstdio>

#include <stack>

#include <vector>

using namespace std;



using i64 = long long;



#define REP(i, stop) for (register int i = 1; i <= stop; ++i)



const int is = 1 << 17;

char ib[is], *ip = ib + is, it;

inline char getc() {

	if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib; }

	return *ip++;

}

inline int read() {

	int r = 0;

	if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';

	else while ((it = *ip++) & 16) r = r * 10 + it - '0';

	return r;

}



const int os = 1 << 17;

char ob[os], *op = ob, ot;

inline void putc(const char c) {

	*op++ = c;

	if (op == ob + os) { fwrite_unlocked(ob, 1, os, stdout); op = ob; }

}

// x shoud be greater than or equal to zero

inline void write(int x) {

	char d[6];

	int i = 0;

	while (true) {

		d[i] = x % 10 + 48;

		x /= 10;

		++i;

		if (x <= 0) break;

	}

	while (i--) {

		putc(d[i]);

	}

	putc(' ');

}



i64 cnt[200001];

bool used[200001];

vector<vector<i64>> G(200001);

void dfs(i64 a) {

  used[a] = true;

  for (i64 b : G[a]) {

    if (!used[b]) {

      cnt[b] += cnt[a];

      dfs(b);

    }

  }

}

signed main() {

  i64 N = read(), Q = read();

  REP(_, N - 1) {

    i64 a = read(), b = read();

    G[a].push_back(b);

    G[b].push_back(a);

  }

  REP(_, Q) {

    i64 p = read(), x = read();

    cnt[p] += x;

  }

  dfs(1);

  REP(i, N) {

    printf("%d ", cnt[i]);

//    write(cnt[i]);

  }

//  fwrite_unlocked(ob, 1, op - ob, stdout);

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <stack>

#include <vector>

using namespace std;



using i64 = long long;



#define REP(i, stop) for (register int i = 1; i <= stop; ++i)



const int is = 1 << 17;

char ib[is], *ip = ib + is, it;

inline char getc() {

	if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib; }

	return *ip++;

}

inline int read() {

	int r = 0;

	if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';

	else while ((it = *ip++) & 16) r = r * 10 + it - '0';

	return r;

}



const int os = 1 << 17;

char ob[os], *op = ob, ot;

inline void putc(const char c) {

	*op++ = c;

	if (op == ob + os) { fwrite_unlocked(ob, 1, os, stdout); op = ob; }

}

// x shoud be greater than or equal to zero

inline void write(i64 x) {

	char d[20];

	int i = 0;

	while (true) {

		d[i] = x % 10 + 48;

		x /= 10;

		++i;

		if (x <= 0) break;

	}

	while (i--) {

		putc(d[i]);

	}

	putc(' ');

}



i64 cnt[200001];

bool used[200001];

i64 st[200001], *tp;

signed main() {

  i64 N = read(), Q = read();

  vector<vector<i64>> G(N + 1);

  REP(_, N - 1) {

    i64 a = read(), b = read();

    G[a].push_back(b);

    if (a != 1) G[b].push_back(a);

  }

  REP(_, Q) {

    i64 p = read(), x = read();

    cnt[p] += x;

  }

  tp = st;

  ++tp;

  *tp = 1;

  while (*tp) {

    i64 a = *tp;

    --tp;

    used[a] = true;

    for (i64 b : G[a]) {

      if (!used[b]) {

        cnt[b] += cnt[a];

        ++tp;

        *tp = b;

      }

    }

  }

  REP(i, N) {

    write(cnt[i]);

  }

  fwrite_unlocked(ob, 1, op - ob, stdout);

}


// Fastest known solution for this problem: