from collections import deque n,m = map(int,input().split()) G = [[] for _ in range(n)] for _ in range(m): a,b = map(int,input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) q = int(input()) for _ in range(q): s = int(input()) s -= 1 dist = [-1] * n dist[s] = 0 q = deque([s]) ret = 0 day = 0 while q: p = q.popleft() for v in G[p]: if dist[v] >= 0: continue ret += 1 dist[v] = dist[p] + 1 if dist[v] <= 2: day = max(day,dist[v] - 1) else: day = max(day,(dist[v] + 1)//2) q.append(v) print(ret,day)