Given a tree of n vertices rooted at 1. Each vertice has a number, which is 0 initially.
There are q queries, they ask you, for every vertice on the simple path from x to y, if the value on this vertice is 0, assign z to it. It is guaranteed that x is an ancestor of y.
Find the number on each vertice after q queries.
Input:
5 3
1 2
2 3
2 4
1 5
1 3 1
1 4 2
1 2 3
Output:
1 1 1 2 0