시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
4 초 256 MB 11 1 1 10.000%

문제

A small island country is developing its transport network. Some of the islands are connected by bridges in such way that there is a unique path between any two islands. In other words, bridges form a tree. Bridges can have different length.

Before opening these bridges to the public it is required to test their safety. To do that, two testers will be traversing some paths with a speed 1 every day for the next q days. Each one will go along his own path, possibly starting at different time. Let's call a bridge tested on i-th day if both testers were going along that bridge during some non-zero time interval. For each of q days determine, if there was a bridge that was tested during that day.

입력

The first line contains two integers n and q (1 ≤ n, q ≤ 105, n ≥ 2) — the number of islands and testing days. The following n - 1 lines describe bridges as follows: ui vi li (1 ≤ ui, vi ≤ n, 1 ≤ li ≤ 109) — endpoints of i-th bridge and its length. The following q lines contain description of the two paths. Each path is described by three numbers bi, ei, si (1 ≤ bi, ei ≤ n, 1 ≤ si ≤ 109, bi ≠ ei) — starting island, ending island and starting time for that tester.

 

출력

Output q lines with answers to queries. The i-th line should contains «YES», if at least one bridge was tested during the i-th day, and «NO» otherwise.

 

예제 입력

8 6
1 2 3
1 3 1
1 4 2
2 5 5
2 6 1
5 7 2
5 8 4
5 3 2 7 4 2
8 6 1 1 7 6
4 5 1 4 5 10
7 8 3 3 4 5
6 7 6 5 1 2
2 1 10 8 3 3

예제 출력

YES
YES
NO
NO
NO
YES

힌트