#include #include using namespace std; struct NODE{ int id; vector link; NODE(){ id=0; link.clear(); } void AddLine(NODE _link){ link.push_back(_link); } bool Check(){ if (link.size()<=1){ return false; } int i,j; for (i=0;iid &&id2>id)){ return true; } } } return false; } }; int main(int argc, char* argv[]) { int N,M; cin>>N>>M; vector a(N+1); int i; int ID; for (i=1;i<=N;i++){ cin>>ID; a[i].id=ID; } int u,v; for (i=1;i<=M;i++){ cin>>u>>v; a[u].AddLine(a[v]); a[v].AddLine(a[u]); } for (i=1;i<=N;i++){ if (a[i].Check()){ cout<<"YES"<