from collections import deque N,M,K=list(map(int,input().split())) X=list(map(int,input().split())) #print(X) if len(set(X))==1: print("Yes") exit() path=[] for i in range(N): path.append([]) for j in range(M): u,v=list(map(int,input().split())) u-=1 v-=1 path[u].append(v) path[v].append(u) for i in range(K): X[i]-=1 for i in range(N): Q=deque() check=set() Q.append((2**i,i,0)) check.add((2**i,i)) cnt=[] for j in range(N): cnt.append(set()) while len(Q)>0: c,p,d=Q.popleft() #print(c,p,d) for j in path[i]: if c&2**j==0 and (c|2**j,j) not in check: check.add((c|2**j,j)) Q.append((c|2**j,j,d+1)) cnt[j].add(d+1) g=set() for j in range(N): g.add(j) for j in X: g=g&cnt[j] #print(i,g,cnt) if len(g)!=0: print("Yes") exit() print("No")