The input contains several test cases, and the first line contains a single integer $T$, the number of test cases.
For each test case:
The first line contains two integers $n,m$.
For the following $n-1$ lines, each line contains three integers $u,v,d$, which means that there is an edge between $u,v$, the weight of this edge is $d$.
For the following $m$ lines, each line contains two integers $l,r$, which means that there is a query for $l,r$.
$1 \le T \le 3$,$1\le n,m,d\le 2\cdot 10^5$, $l \le r$, all input are integers.