def dfs(v, d): if d in dist[v]: return dist[v].add(d) for nv in G[v]: if seen[nv]==1: continue seen[nv] = 1 dfs(nv, d+1) seen[nv] = 0 #print(dist) import sys input = sys.stdin.readline N, M, K = map(int, input().split()) X = list(map(int, input().split())) G = [[] for _ in range(N)] for _ in range(M): u, v = map(int, input().split()) u-=1 v-=1 G[u].append(v) G[v].append(u) for i in range(K): X[i]-=1 for i in range(N): dist = [set() for _ in range(N)] seen = [0 for _ in range(N)] seen[i] = 1 dfs(i, 0) tmp = dist[X[0]] for j in range(1, K): tmp &= dist[X[j]] if len(tmp)>0: print("Yes") exit() print("No")