#ifndef LOCAL #include using namespace std; #define debug(...) (void(0)) #else #include "algo/debug.h" #endif void solve() { int N, M, K; cin >> N >> M >> K; vector X(K); for (int i = 0; i < K; i++) cin >> X[i], X[i]--; vector> G(N); for (int i = 0; i < M; i++) { int a, b; cin >> a >> b; a--; b--; G[a].push_back(b); G[b].push_back(a); } const int S = 1 << N; vector res(N, S - 1); for(int t = 0; t < K; t++) { vector> dp(N, vector(S)); dp[X[t]][1 << (X[t])] = 1; vector T(N); for(int s = 0; s < S; s++) for(int i = 0; i < N; i++) if(dp[i][s]) { T[std::popcount((unsigned)s) - 1] |= 1 << i; for(int nv: G[i]) if(!(s >> nv & 1)) dp[nv][s | (1 << nv)] = 1; } for(int i = 0; i < N; i++) res[i] &= T[i]; } for(int i = 0; i < N; i++) if(res[i]) { cout << "Yes\n";return; } cout << "No\n"; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int tt = 1; // std::cin >> tt; while (tt--) { solve(); } }