Time Limit: 10000ms
Memory Limit: 65535kb
Check if there exists a path of length L in the given tree with weight assigned to each edges.
Only one test case.
The first line contains two integers n and q, which denote the number of nodes and queries, repectively.
The following (n−1) with three integers ai,bi,ci, which denote the edge between ai and bi, with weight ci.
Note that the nodes are labled by 1,2,…,n.
The last line contains q integers L1,L2,…,Lq, denote the queries.
For each query, print the result in seperated line. If there exists path of given length, print "Yes". Otherwise, print "No".