#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
vector<int> edge[maxn];
void marry(int a, int b) { edge[a].push_back(b); }
int in[maxn], out[maxn];
void dfs(int node, int pre, int& now) {
  in[node] = ++now;
  int len2 = edge[node].size();
  for (int i = 0; i < len2; ++i) {
    if (edge[node][i] == pre) continue;
    dfs(edge[node][i], node, now);
  }
  out[node] = now;
}
vector<int> ask[maxn];
void marry_ask(int a, int b) { ask[a].push_back(b); }
struct mytree {
  int v;
  int sum;
} tree[maxn << 2];
void build(int node, int l, int r) {
  tree[node].v = tree[node].sum = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(node << 1, l, mid);
  build(node << 1 | 1, mid + 1, r);
}
void push_up(int node, int l, int r) {
  if (tree[node].v)
    tree[node].sum = r - l + 1;
  else
    tree[node].sum = tree[node << 1].sum + tree[node << 1 | 1].sum;
}
void update(int node, int l, int r, int left, int right, int how) {
  if (left <= l && r <= right) {
    tree[node].v += how;
    push_up(node, l, r);
    return;
  }
  int mid = (l + r) >> 1;
  if (left <= mid) update(node << 1, l, mid, left, right, how);
  if (right > mid) update(node << 1 | 1, mid + 1, r, left, right, how);
  push_up(node, l, r);
}
int now;
int ans[maxn];
void solve(int node, int pre) {
  int len1 = ask[node].size();
  for (int i = 0; i < len1; ++i) {
    int who = ask[node][i];
    update(1, 1, now, in[who], out[who], 1);
  }
  ans[node] = tree[1].sum;
  if (ans[node]) ans[node]--;
  int len2 = edge[node].size();
  for (int i = 0; i < len2; ++i) {
    if (edge[node][i] == pre) continue;
    solve(edge[node][i], node);
  }
  for (int i = 0; i < len1; ++i) {
    int who = ask[node][i];
    update(1, 1, now, in[who], out[who], -1);
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int a, b;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a, &b);
    marry(a, b);
    marry(b, a);
  }
  now = 0;
  dfs(1, 1, now);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &a, &b);
    marry_ask(a, b);
    marry_ask(b, a);
    marry_ask(a, a);
    marry_ask(b, b);
  }
  build(1, 1, n);
  solve(1, 1);
  for (int i = 1; i <= n; ++i) {
    printf("%d ", ans[i]);
  }
  return 0;
}

### Prompt

Your task is to create a Cpp solution to the following problem:

The Little Elephant loves trees very much, he especially loves root trees.

He's got a tree consisting of n nodes (the nodes are numbered from 1 to n), with root at node number 1. Each node of the tree contains some list of numbers which initially is empty. 

The Little Elephant wants to apply m operations. On the i-th operation (1 ≤ i ≤ m) he first adds number i to lists of all nodes of a subtree with the root in node number ai, and then he adds number i to lists of all nodes of the subtree with root in node bi.

After applying all operations the Little Elephant wants to count for each node i number ci — the number of integers j (1 ≤ j ≤ n; j ≠ i), such that the lists of the i-th and the j-th nodes contain at least one common number.

Help the Little Elephant, count numbers ci for him.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 105) — the number of the tree nodes and the number of operations. 

Each of the following n - 1 lines contains two space-separated integers, ui and vi (1 ≤ ui, vi ≤ n, ui ≠ vi), that mean that there is an edge between nodes number ui and vi. 

Each of the following m lines contains two space-separated integers, ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi), that stand for the indexes of the nodes in the i-th operation.

It is guaranteed that the given graph is an undirected tree.

Output

In a single line print n space-separated integers — c1, c2, ..., cn.

Examples

Input

5 1
1 2
1 3
3 5
3 4
2 3


Output

0 3 3 3 3 

Input

11 3
1 2
2 3
2 4
1 5
5 6
5 7
5 8
6 9
8 10
8 11
2 9
3 6
2 8


Output

0 6 7 6 0 2 0 5 4 5 5 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
vector<int> edge[maxn];
void marry(int a, int b) { edge[a].push_back(b); }
int in[maxn], out[maxn];
void dfs(int node, int pre, int& now) {
  in[node] = ++now;
  int len2 = edge[node].size();
  for (int i = 0; i < len2; ++i) {
    if (edge[node][i] == pre) continue;
    dfs(edge[node][i], node, now);
  }
  out[node] = now;
}
vector<int> ask[maxn];
void marry_ask(int a, int b) { ask[a].push_back(b); }
struct mytree {
  int v;
  int sum;
} tree[maxn << 2];
void build(int node, int l, int r) {
  tree[node].v = tree[node].sum = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(node << 1, l, mid);
  build(node << 1 | 1, mid + 1, r);
}
void push_up(int node, int l, int r) {
  if (tree[node].v)
    tree[node].sum = r - l + 1;
  else
    tree[node].sum = tree[node << 1].sum + tree[node << 1 | 1].sum;
}
void update(int node, int l, int r, int left, int right, int how) {
  if (left <= l && r <= right) {
    tree[node].v += how;
    push_up(node, l, r);
    return;
  }
  int mid = (l + r) >> 1;
  if (left <= mid) update(node << 1, l, mid, left, right, how);
  if (right > mid) update(node << 1 | 1, mid + 1, r, left, right, how);
  push_up(node, l, r);
}
int now;
int ans[maxn];
void solve(int node, int pre) {
  int len1 = ask[node].size();
  for (int i = 0; i < len1; ++i) {
    int who = ask[node][i];
    update(1, 1, now, in[who], out[who], 1);
  }
  ans[node] = tree[1].sum;
  if (ans[node]) ans[node]--;
  int len2 = edge[node].size();
  for (int i = 0; i < len2; ++i) {
    if (edge[node][i] == pre) continue;
    solve(edge[node][i], node);
  }
  for (int i = 0; i < len1; ++i) {
    int who = ask[node][i];
    update(1, 1, now, in[who], out[who], -1);
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int a, b;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a, &b);
    marry(a, b);
    marry(b, a);
  }
  now = 0;
  dfs(1, 1, now);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &a, &b);
    marry_ask(a, b);
    marry_ask(b, a);
    marry_ask(a, a);
    marry_ask(b, b);
  }
  build(1, 1, n);
  solve(1, 1);
  for (int i = 1; i <= n; ++i) {
    printf("%d ", ans[i]);
  }
  return 0;
}

```