#include using namespace std; vector edges[100000]; int main(){ int N, M; cin >> N >> M; for(int i=0; i> a >> b; edges[a-1].push_back(b-1); edges[b-1].push_back(a-1); } int Q; cin >> Q; while(Q--){ int a; cin >> a; a--; const int INF = 1e9; vector dist(N, INF); dist[a] = 0; queue que; que.push(a); int num = -1, mx = 0; while(que.size()){ int i = que.front(); que.pop(); num++; mx = dist[i]; for(int j : edges[i]) if(dist[j] == INF){ dist[j] = dist[i] + 1; que.push(j); } } int day = 0; while((1<