#include #include #define rep(i,n) for(int i=0;i vi; typedef vector vl; typedef vector> vvi; typedef vector> vvl; typedef long double ld; typedef pair P; template ostream& operator<<(ostream& os, const static_modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const dynamic_modint& a) {os << a.val(); return os;} template istream& operator>>(istream& is, static_modint& a) {long long x; is >> x; a = x; return is;} template istream& operator>>(istream& is, dynamic_modint& a) {long long x; is >> x; a = x; return is;} template istream& operator>>(istream& is, vector& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template ostream& operator<<(ostream& os, const pair& p){os << p.first << ' ' << p.second; return os;} template ostream& operator<<(ostream& os, const vector& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const vector>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} template ostream& operator<<(ostream& os, const set& se){for(T x : se) os << x << " "; os << "\n"; return os;} template ostream& operator<<(ostream& os, const unordered_set& se){for(T x : se) os << x << " "; os << "\n"; return os;} template ostream& operator<<(ostream& os, const atcoder::segtree& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const atcoder::lazy_segtree& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;} template void chmin(T& a, T b){a = min(a, b);} template void chmax(T& a, T b){a = max(a, b);} int main(){ int n, m, k; cin >> n >> m >> k; vector a(k); cin >> a; rep(i, k) a[i]--; vector> G(n, vector(n)); rep(i, m){ int u, v; cin >> u >> v; u--; v--; G[u][v] = 1; G[v][u] = 1; } vector>> possible(n, vector>(n, vector(n))); vector>> dp(n, vector>(n, vector(1 << n))); rep(start, n){ dp[start][start][1 << start] = 1; possible[start][start][0] = 1; rep(s, 1 << n){ rep(from, n){ if((s >> from) & 1){ if(dp[start][from][s] == 0) continue; rep(to, n){ if(G[from][to] == 0) continue; if((s >> to) & 1) continue; dp[start][to][s | (1 << to)] = 1; possible[start][to][__builtin_popcount(s)] = 1; } } } } } string ans = "No"; rep(destination, n){ rep(t, n){ bool success = true; rep(i, k){ if(possible[a[i]][destination][t] == 0) success = false; } if(success) ans = "Yes"; } } cout << ans << "\n"; return 0; }