#include #include #include #include using namespace std; using ll = long long; using P = pair; int main(void){ int n, m, k; cin >> n >> m >> k; vector x(k); for(auto&y:x) cin >> y, y--; vector> to(n); for(int i=0; i> u >> v; u--, v--; to[u].push_back(v); swap(u, v); to[u].push_back(v); } vector ok(n, vector(n, vector(2))); auto BFS=[&](int st){ queue

bfs; bfs.emplace(0, st); while(bfs.size()){ auto [d, id]=bfs.front(); bfs.pop(); if(ok[st][id][d]) continue; ok[st][id][d]=true; for(auto p:to[id]){ bfs.emplace(d^1, p); } } }; for(int i=0; i