Given a tree with N nodes we are required to seperate a connected component with exactly k nodes. You are given queries specifying this k. We need to find the minimum edges to be removed for each query.

First line specifies N.

Next N-1 lines specify edges.

Next line shows Q(number of queries).

Subsequent Q lines contain k for each query.

Constraint:

N <= 3000

Q <= 3000

K <= N

Example:

Input:

5

1 2

1 3

1 4

1 5

3

1

2

4

Output:

1

3

1

same discussion : https://codeforces.com/blog/entry/68398