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) def dfs(pos,depth,vis,dist): # print(pos,depth) dist[pos].add(depth) for nxt in G[pos]: # for nxt in range(N): if pos==nxt:continue if vis[nxt]: continue vis[nxt]=True dfs(nxt,depth+1,vis,dist) # vis[nxt]=False dist=[] for x in X: vis=[False for _ in range(N)] d=[set() for _ in range(N)] vis[x-1]=True dfs(x-1,0,vis,d) dist.append(d) for j in range(N): s=dist[0][j] for i in range(1,K): s&=dist[i][j] if len(s)>0: print("Yes") exit() print("No")