typedef long long ll; typedef long double ld; #include using namespace std; #define int long long struct UnionFind { vector par; UnionFind() { } UnionFind(int n) : par(n, -1) { } void init(int n) { par.assign(n, -1); } int root(int x) { if (par[x] < 0) return x; else return par[x] = root(par[x]); } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (par[x] > par[y]) swap(x, y); // merge technique par[x] += par[y]; par[y] = x; return true; } int size(int x) { return -par[root(x)]; } }; signed main(){ ll n,m; std::cin >> n>>m; ll s,g; std::cin >> s>>g; s--;g--; vector a(m),b(m); for (int i = 0; i < m; i++) { std::cin >> a[i]>>b[i]; a[i]--; b[i]--; } ll u; std::cin >> u; vector dame(n); for (int i = 0; i < u; i++) { ll tmp; std::cin >> tmp; tmp--; dame[tmp]=true; } UnionFind uf(n); for (int i = 0; i < m; i++) { if(dame[a[i]]||dame[b[i]]){ }else{ uf.merge(a[i],b[i]); } } if(uf.issame(s,g)){ std::cout << "Yes" << std::endl; }else{ std::cout << "No" << std::endl; } }