cin >> Kase; while (Kase--) { cin >> n >> m >> k; for (int i = 1; i <= n; ++i) { fa[i] = i; sz[i] = 1; tag[i] = false; vis[i] = false; g[i].clear(); } for (int i = 1; i <= m; ++i) { cin >> e[i].first >> e[i].second; } for (int i = 1; i <= k; ++i) { cin >> a[i]; tag[a[i]] = true; sz[a[i]] = 0; } for (int i = 1; i <= m; ++i) { if (tag[e[i].first] == 0 && tag[e[i].second] == 0) { mergf(e[i].first, e[i].second); } } for (int u, v, i = 1; i <= m; ++i) { tie(u, v) = e[i];
v = findf(v); u = findf(u);
if (tag[u] || tag[v]) { g[u].emplace_back(v); g[v].emplace_back(u); } }
int start = findf(1); double ans = sz[start]; double tmp = 0;
for (auto u:g[start]) { if (vis[u])continue; else vis[u] = true;
double sum = 0; for (auto v:g[u])if (v != start)sum += sz[v]; sum /= 1.0 * g[u].size();
if (sum > tmp) tmp = sum; } ans += tmp; printf("%.6f\n", ans); }