You are a teacher at Iazu High School is the Zuia Kingdom. There are $N$ cities and $N-1$ roads connecting them that allow you to move from one city to another by way of more than one road. Each of the roads allows bidirectional traffic and has a known length.

As a part of class activities, you are planning the following action assignment for your students. First, you come up with several themes commonly applicable to three different cities. Second, you assign each of the themes to a group of three students. Then, each student of a group is assigned to one of the three cities and conducts a survey on it. Finally, all students of the group get together in one of the $N$ cities and compile their results.

After a theme group has completed its survey, the three members move from the city on which they studied to the city for getting together. The longest distance they have to travel for getting together is defined as the cost of the theme. You want to select the meeting city so that the cost for each theme becomes minimum.

Given the number of cities, road information and $Q$ sets of three cities for each theme, make a program to work out the minimum cost for each theme.



Input

The input is given in the following format.


$N$ $Q$
$u_1$ $v_1$ $w_1$
$u_2$ $v_2$ $w_2$
$...$
$u_{N-1}$ $v_{N-1}$ $w_{N-1}$
$a_1$ $b_1$ $c_1$
$a_2$ $b_2$ $c_2$
$...$
$a_Q$ $b_Q$ $c_Q$


The first line provides the number of cities in the Zuia Kingdom $N$ ($3 \leq N \leq 100,000$) and the number of themes $Q$ ($1 \leq Q \leq 100,000$). Each of the subsequent $N-1$ lines provides the information regarding the $i$-th road $u_i,v_i,w_i$ ($ 1 \leq u_i < v_i \leq N, 1 \leq w_i \leq 10,000$), indicating that the road connects cities $u_i$ and $v_i$, and the road distance between the two is $w_i$. Each of the $Q$ lines that follows the above provides the three cities assigned to the $i$-th theme: $a_i,b_i,c_i$ ($1 \leq a_i < b_i < c_i \leq N$).

Output

For each theme, output the cost in one line.

Examples

Input

5 4
1 2 3
2 3 4
2 4 2
4 5 3
1 3 4
1 4 5
1 2 3
2 4 5


Output

4
5
4
3


Input

5 3
1 2 1
2 3 1
3 4 1
4 5 1
1 2 3
1 3 5
1 2 4


Output

1
2
2


Input

15 15
1 2 45
2 3 81
1 4 29
1 5 2
5 6 25
4 7 84
7 8 56
4 9 2
4 10 37
7 11 39
1 12 11
11 13 6
3 14 68
2 15 16
10 13 14
13 14 15
2 14 15
7 12 15
10 14 15
9 10 15
9 14 15
8 13 15
5 6 13
11 13 15
12 13 14
2 3 10
5 13 15
10 11 14
6 8 11


Output

194
194
97
90
149
66
149
140
129
129
194
111
129
194
140
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

UL N, Q;
UL P[100000][18];
UL D[100000];
UL C[100000];
vector<pair<UL, UL>> E[100000];

UL LCA(UL a, UL b) {
	if (C[a] < C[b]) swap(a, b);
	UL d = C[a] - C[b];
	for (UL i = 17; i != ~0u; i--) {
		if ((1u << i) & d) a = P[a][i];
	}
	if (a == b) return a;
	for (UL i = 17; i != ~0u; i--) {
		if (P[a][i] == P[b][i]) continue;
		a = P[a][i]; b = P[b][i];
	}
	return P[a][0];
}

pair<UL, UL> MP(UL a, UL b) {
	UL X = D[LCA(a, b)];
	if (D[a] < D[b]) swap(a, b);
	UL Y = D[a] - D[b] + X + X;
	for (UL i = 17; i != ~0u; i--) {
		if (D[P[a][i]] * 2 <= Y) continue;
		a = P[a][i];
	}
	if (X == D[a]) return{ a,a };
	else return { a, P[a][0] };
}

UL Dist(UL a, UL b) {
	UL X = D[LCA(a, b)];
	return D[a] + D[b] - X - X;
}

int main() {
	scanf("%u%u", &N, &Q);
	rep(i, N - 1) {
		UL u, v, w; scanf("%u%u%u", &u, &v, &w); u--; v--;
		E[u].push_back({ v, w });
		E[v].push_back({ u, w });
	}
	{
		P[0][0] = 0; D[0] = 0; C[0] = 0;
		queue<UL> G; G.push(0);
		while (G.size()) {
			UL p = G.front(); G.pop();
			for (auto& e : E[p]) {
				if (P[p][0] == e.first) continue;
				P[e.first][0] = p;
				D[e.first] = D[p] + e.second;
				C[e.first] = C[p] + 1;
				G.push(e.first);
			}
		}
	}
	rep(i, 17) rep(j, N) P[j][i + 1] = P[P[j][i]][i];

	rep(q, Q) {
		UL a, b, c; scanf("%u%u%u", &a, &b, &c); a--; b--; c--;
		UL ans = ~0u;
		rep(t, 3) {
			auto mp = MP(a, b);
			UL q1 = max(max(Dist(mp.first, a), Dist(mp.first, b)), Dist(mp.first, c));
			UL q2 = max(max(Dist(mp.second, a), Dist(mp.second, b)), Dist(mp.second, c));
			ans = min(ans, min(q1, q2));
			swap(a, b); swap(b, c);
		}
		printf("%u\n", ans);
	}
	return 0;
}

