// Adjacency list implementation of FIFO push relabel maximum flow
// with the gap relabeling heuristic. This implementation is
// significantly faster than straight Ford-Fulkerson. It solves
// random problems with 10000 vertices and 1000000 edges in a few
// seconds, though it is possible to construct test cases that
// achieve the worst-case.
//
// Running time:
// O(|V|^3)
//
// INPUT:
// - graph, constructed using AddEdge()
// - source
// - sink
//
// OUTPUT:
// - maximum flow value
// - To obtain the actual flow values, look at all edges with
// capacity > 0 (zero capacity edges are residual edges).
#include <cmath>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
#define MAX 1000005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007LL
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vll vector<ll>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long LL;
struct Edge {
int from, to, cap, flow, index;
Edge(int from, int to, int cap, int flow, int index) :
from(from), to(to), cap(cap), flow(flow), index(index) {}
};
struct PushRelabel {
int N;
vector<vector<Edge> > G;
vector<LL> excess;
vector<int> dist, active, count;
queue<int> Q;
PushRelabel(int N) : N(N), G(N), excess(N), dist(N), active(N), count(2*N) {}
void AddEdge(int from, int to, int cap) {
G[from].push_back(Edge(from, to, cap, 0, G[to].size()));
if (from == to) G[from].back().index++;
G[to].push_back(Edge(to, from, 0, 0, G[from].size() - 1));
}
void Enqueue(int v) {
if (!active[v] && excess[v] > 0) { active[v] = true; Q.push(v); }
}
void Push(Edge &e) {
int amt = int(min(excess[e.from], LL(e.cap - e.flow)));
if (dist[e.from] <= dist[e.to] || amt == 0) return;
e.flow += amt;
G[e.to][e.index].flow -= amt;
excess[e.to] += amt;
excess[e.from] -= amt;
Enqueue(e.to);
}
void Gap(int k) {
for (int v = 0; v < N; v++) {
if (dist[v] < k) continue;
count[dist[v]]--;
dist[v] = max(dist[v], N+1);
count[dist[v]]++;
Enqueue(v);
}
}
void Relabel(int v) {
count[dist[v]]--;
dist[v] = 2*N;
for (int i = 0; i < G[v].size(); i++)
if (G[v][i].cap - G[v][i].flow > 0)
dist[v] = min(dist[v], dist[G[v][i].to] + 1);
count[dist[v]]++;
Enqueue(v);
}
void Discharge(int v) {
for (int i = 0; excess[v] > 0 && i < G[v].size(); i++) Push(G[v][i]);
if (excess[v] > 0) {
if (count[dist[v]] == 1)
Gap(dist[v]);
else
Relabel(v);
}
}
LL GetMaxFlow(int s, int t) {
count[0] = N-1;
count[N] = 1;
dist[s] = N;
active[s] = active[t] = true;
for (int i = 0; i < G[s].size(); i++) {
excess[s] += G[s][i].cap;
Push(G[s][i]);
}
while (!Q.empty()) {
int v = Q.front();
Q.pop();
active[v] = false;
Discharge(v);
}
LL totflow = 0;
for (int i = 0; i < G[s].size(); i++) totflow += G[s][i].flow;
return totflow;
}
};
vector<pii> khali;
vector<vector<pii>> adj;
int n;
bool visited[200];
pii p[200];
vi mera[200];
int level[200];
int u[3005],v[3005],cap[3005];
vi bc;
int solve(vector<bool> active,vector<vector<pii>> adj)
{
vector<int> temp;
for(int i=0;i<active.size();i++)
{
if(active[i])
{
temp.pb(i);
//cout<<i<<" ";
}
}
//cout<<endl;
if(temp.size()==1)
return temp[0];
int x=temp.size();
PushRelabel pr(n);
for(int i=0;i<n;i++)
{
for(auto j:adj[i])
{
pr.AddEdge(i,j.FF,j.SS);
//pr.AddEdge(j.FF,i,j.SS);
}
}
int ans=pr.GetMaxFlow(temp[0],temp[1]);
//cout<<temp[0]<<" cut "<<temp[1]<<" "<<ans<<endl;
clr(visited);
queue<int> q;
q.push(temp[0]);
visited[temp[0]]=true;
while(!q.empty())
{
int now=q.front();
q.pop();
for(auto x:pr.G[now])
{
if(x.cap-x.flow>0)
{
if(!visited[x.to])
{
q.push(x.to);
visited[x.to]=true;
}
}
}
}
std::vector<vector<pii>> xd(adj);
vector<bool> tt(active);
for(int i=0;i<n;i++)
{
if(visited[i])
{
//adj[i].clear();
active[i]=0;
}
else
{
//xd[i].clear();
tt[i]=0;
}
}
int one=solve(tt,xd);
int two=solve(active,adj);
p[one]=mp(two,ans);
mera[two].pb(one);
//cout<<"joda "<<one<<" "<<two<<" "<<ans<<endl;
return two;
}
void DFS(int x,int l)
{
level[x]=l;
for(auto i:mera[x])
DFS(i,l+1);
}
int main()
{
int t;
cin>>t;
while(t--)
{
adj.clear();
clr(p);
for(int i=0;i<200;i++)
mera[i].clear();
clr(level);
bc.clear();
int m;
cin>>n>>m;
for(int i=0;i<n;i++)
{
adj.pb(khali);
}
for(int i=0;i<m;i++)
{
cin>>u[i]>>v[i]>>cap[i];
u[i]--;
v[i]--;
adj[u[i]].pb(mp(v[i],cap[i]));
adj[v[i]].pb(mp(u[i],cap[i]));
}
vector<bool> active;
for(int i=0;i<n;i++)
active.pb(true);
int root=solve(active,adj);
DFS(root,1);
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
int one=i,two=j,now=MOD;
while(level[one]>level[two])
{
now=min(now,p[one].SS);
one=p[one].FF;
}
while(level[one]<level[two])
{
now=min(now,p[two].SS);
two=p[two].FF;
}
while(one!=two)
{
now=min(now,p[one].SS);
one=p[one].FF;
now=min(now,p[two].SS);
two=p[two].FF;
}
bc.pb(now);
}
}
sort(bc.begin(), bc.end());
int q;
cin>>q;
while(q--)
{
int x;
cin>>x;
int asd=upper_bound(bc.begin(), bc.end(),x)-bc.begin();
cout<<asd<<endl;
}
}
}
Ly8gQWRqYWNlbmN5IGxpc3QgaW1wbGVtZW50YXRpb24gb2YgRklGTyBwdXNoIHJlbGFiZWwgbWF4aW11bSBmbG93Ci8vIHd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