#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> PII;
//typedef long long LL;

int dep[100010];
int cnt[100010];
int  fa[100010];
int son[100010];
int top[100010];
int idx[100010];
int tot;

vector<PII> E[100010];
int f[100010];

void dfs(int u)
{
	cnt[u] = 1;
	son[u] = 0;
	for (int i = 0; i < E[u].size(); i++) {
		int v = E[u][i].first;
		if (v == fa[u]) continue;
		fa[v] = u;
		dep[v] = dep[u] + 1;
		dfs(v);
		if (cnt[v] > cnt[son[u]]) son[u] = v;
		cnt[u] += cnt[v];
	}
}

void build(int u, int root)
{
	idx[u] = ++tot;
	top[u] = root;
	if (son[u]) build(son[u], root);
	for (int i = 0; i < E[u].size(); i++) {
		int v = E[u][i].first;
		if (v == fa[u] || v == son[u]) continue;
		build(v, v);
	}
}

int find(int u, int v)
{
	int p = top[u];
	int q = top[v];
	while (p != q) {
		if (dep[p] < dep[q]) {
			swap(p, q);
			swap(u, v);
		}
		u = fa[p];
		p = top[u];
	}
	if (dep[u] > dep[v]) swap(u, v);
	return u;
}

int get(int u, int v)
{
	int lca = find(u, v);
	return f[u] + f[v] - 2 * f[lca];
}


void bfs(int u, int fa)
{
	for (int i = 0; i < E[u].size(); i++) {
		int v = E[u][i].first;
		int w = E[u][i].second;
		if (v == fa) continue;
		f[v] = f[u] + w;
		bfs(v, u);
	}
}

int main()
{
	int T;
	scanf("%d", &T);
	for (int cas = 1; cas <= T; cas++) {
		printf("Case #%d:\n", cas);
		int n, Q;
		scanf("%d%d", &n, &Q);
		for (int i = 1; i <= n; i++) {
			f[i] = 0;
			E[i].clear();
		}
		for (int i = 1; i < n; i++) {
			int u, v, w;
			scanf("%d%d%d", &u, &v, &w);
			E[u].push_back(PII(v, w));
			E[v].push_back(PII(u, w));
		}
		int X, Y, Z;
		scanf("%d%d%d", &X, &Y, &Z);
		bfs(1, 0);

		tot = 0;
		dfs(1);
		build(1, 1);
		
		while (Q--) {
			int u, v;
			scanf("%d%d", &u, &v);
			int res = get(u, v);
			//cout<<res<<" "<<get(u,X)+get(v,Y)+Z<<" "<<get(u,Y)+get(v,X)+Z<<" | "<<get(v,X)<<endl;
			printf("%d\n", max(0,res-min(get(u,X)+get(v,Y)+Z, get(u,Y)+get(v,X)+Z)));
		}
	}
	return 0;
}
