n,m,k=map(int,input().split()) x=[*map(lambda a:int(a)-1,input().split())] g=[[]for _ in range(n)] for i in range(m): u,v=map(int,input().split()) g[u-1].append(v-1) g[v-1].append(u-1) ans=[[1]*(n+1)for _ in range(n)] for t in range(k): dp=[[[0]*(1<>g[j][k])&1:continue dp[i+1][g[j][k]][tmp|(1<