#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define mp make_pair
typedef long long ll;
const int N=2e5+5;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const ll INF=1e18+3;
#define DEBUG
#ifdef DEBUG
#define debug(x...) cerr<<"["#x"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(x)
#else
#define debug(...) {}
#endif
//debug(n,m);debug("a,b");
//double max:0x7f,0x43 min:0xfe 0x c2 int:0x3f
//运算符 priority 后缀 前缀 */+- 位移 比较 &^| && || 赋值
void solve()
{
int n,m,q;
cin>>n>>m>>q;
vector<bool> a(n+1);
for(int i=1;i<=m;i++) {
int x;
cin>>x;
a[x]=1;
}
vector h(n+1,vector<array<int,2>>());
for(int i=1;i<n;i++){
int x,y,d;
cin>>x>>y>>d;
h[x].push_back({y,d});
h[y].push_back({x,d});
}
int tot=0;
vector<int> dfn(2*n+5),id(2*n+5),lg2(2*n+5);
vector<ll> dis(n+1),di(n+1);
vector f(20,vector<int>(2*n+5));
auto dfs=[&](auto self,int x,int pre)-> void{
f[0][++tot]=x;
dfn[x]=tot;
for(auto [y,d]:h[x]){
if(y==pre) {
if(a[x]) dis[x]=0; else dis[x]=dis[pre]+d;
di[x]=di[pre]+d;
continue;
}
self(self,y,x);
f[0][++tot]=x;
}
return;
};
auto prelca=[&]()->void{
for(int i=2;i<=2*n;i++) lg2[i]=lg2[i/2]+1;
for(int i=1;i<=20;i++){
int r=(1<<(i-1));
for(int l=1;l<=2*n-r+1;l++){
f[i][l]=dfn[f[i-1][l]]>dfn[f[i-1][r+l]]?f[i-1][r+l]:f[i-1][l];
}
}
};
auto find_lca=[&](int x,int y)->int {
if(x==y) return x;
x=dfn[x],y=dfn[y];
if(x>y) swap(x,y);
int lg=lg2[y-x+1];
return dfn[f[lg][x]]>dfn[f[lg][y-(1<<lg)+1]]?f[lg][y-(1<<lg)+1]:f[lg][x];
};
dfs(dfs,1,0);
//cout<<tot<<endl;
prelca();
//for(int i=1;i<=23;i++) cout<<f[0][i]<<" "; cout<<endl;
//for(int i=1;i<=23;i++) cout<<dfn[f[0][i]]<<" "; cout<<endl;
//cout<<find_lca(4,12)<<endl;
while(q--){
int c;
cin>>c;
vector<int> qe(c+5);
for(int i=0;i<c;i++) cin>>qe[i];
sort(qe.begin(),qe.end(),[&](int x,int y){
return dis[x]>dis[y];
});
ll ans=INF;
ll dt=di[qe[0]],dq=qe[0];
for(int i=0;i<c;i++){
dq=find_lca(dq,qe[i]);
dt=max(dt,di[qe[i]]);
ans=min(ans,max(dt-di[dq],dis[qe[i+1]]));
}
cout<<ans<<"\n";
}
return;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
#if 1
int T; cin>>T; while(T--) solve();
#else
solve();
#endif
return 0;
}