#include using namespace std; int main(){ int n,m; assert(cin>>n>>m); for (int i=n; i--;) {int x; assert(cin>>x);} vector> e(n); for (int i=m; i--;){ int a,b; cin>>a>>b; --a,--b; if (not (0<=a and a seen(n); queue todo; todo.push(0); while (not todo.empty()){ int x=todo.front(); todo.pop(); for (auto y: e[x]){ if (not seen[y]){ seen[y]=true; todo.push(y); } } } if (not seen[1]){ cout<<"Vertices 1 and 2 are not connected."<