#include #include #include #include using namespace std; int main() { int n, m, s, g; cin >> n >> m >> s >> g; s--; g--; vector> gr(n); for (int i = 0; i < m; i++) { int f, t; cin >> f >> t; f--; t--; gr[f].push_back(t); gr[t].push_back(f); } int u; cin >> u; set I; for (int i = 0; i < u; i++) { int j; cin >> j; j--; I.insert(j); } vector island(n, false); island[s] = true; queue check; check.push(s); while(!check.empty()) { int c = check.front(); for (int i = 0; i < gr[c].size(); i++) { if (island[gr[c][i]] == false && !I.count(gr[c][i])) { island[gr[c][i]] = true; check.push(gr[c][i]); } } check.pop(); } if (island[g]) cout << "Yes" << endl; else cout << "No" << endl; return 0; }