The Cow Gathering#10404

The Cow Gathering

1 second
128 megabytes
Hard

Cows from around the world have assembled for a massive gathering. There are cows and n - 1 pairs of cows who are friends with each other. Every cow knows every other cow through some chain of friendships.

They have had great fun, but now it is time for them to leave, one by one. They want to leave in an order such that, as long as at least two cows remain, every remaining cow has at least one remaining friend. Furthermore, due to issues with luggage storage, there are pairs of cows (a_i, b_i) such that cow a_i must leave before cow b_i. Note that cows a_i and b_i may or may not be friends.

For each cow, help the cows determine whether she can be the last one to leave. It is possible that there is no order of leaving that satisfies all the constraints above.

Input

The first line contains two integers and m~(1 \le n, m \le 10^5).

Each of the next n - 1 lines contains two integers x_i and y_i~(1 \le x_i, y_i \le n, x_i \ne y_i), meaning that cows x_i and y_i are friends.

Each of the next lines contains two integers a_i and b_i~(1 \le a_i, b_i \le n, a_i \ne b_i), meaning that cow a_i must leave the gathering before cow b_i.

Output

Print lines. The -th line should contain if cow can be the last one to leave, and otherwise.

Examples

Example 1

Loading
Loading