You are given a tree of n vertices. The vertices are numbered from 1 to n.
You will need to assign a weight to each edge. Let the weight of the i-th edge be a_i (1≤i≤n−1). The weight of each edge should be an integer between 0 and 230−1, inclusive.
You are given q conditions. Each condition consists of three integers u, v, and x. This means that the Bitwise XOR of all edges on the shortest path from u to v should be x.
Find out if there exist a_1,a_2,…,a_n−1 that satisfy the given conditions. If yes, print a solution such that a_1⊕a_2⊕…⊕a_n−1 is the smallest. Here, ⊕ denotes the bitwise XOR operation.
If there are multiple solutions such that a_1⊕a_2⊕…⊕a_n−1 is the smallest, print any.
The first line contains two integers n and q (2≤n≤2.5⋅105, 0≤q≤2.5⋅105).
The i-th of the following n−1 lines contains two integers x_i and y_i (1≤x_i,y_i≤n, x_i=y_i), meaning that the i-th edge connects vertices x_i and y_i in the tree.
It is guaranteed that the given edges form a tree.
The following q lines contain information about conditions.
Each line contains three integers u, v, x (1≤u,v≤n, u=v, 0≤x≤230−1), meaning that the bitwise XOR of all edges on the shortest path from u to v should be x.
If there do not exist a_1,a_2,…,a_n−1 that satisfy the given conditions, print "No".
Otherwise, print "Yes" in the first line.
Then print n−1 integers on the next line, where the i-th integer is the weight of the i-th edge. If there are multiple solutions that satisfy the given conditions, print a solution such that a_1⊕a_2⊕…⊕a_n−1 is the smallest.
If there are multiple solutions such that a_1⊕a_2⊕…⊕a_n−1 is the smallest, print any.
When printing "Yes" or "No", you can print each letter in any case (either upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.