#include #include #include #include #include #include #include #include #include #include #include #include #define INF 1000000000ll #define MOD 1000000007ll #define EPS 1e-10 #define REP(i,m) for(long long i=0; i P; typedef long double ld; vector a; vector> adj; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n,m; cin>>n>>m; a.resize(n); adj.resize(n); REP(i,n) cin>>a[i]; REP(i,m) { ll u,v; cin>>u>>v; u--; v--; adj[u].pb(v); adj[v].pb(u); } REP(i,n) { set sita,ue; REP(j,(ll)adj[i].size()) { if(a[adj[i][j]]a[i]) ue.insert(a[adj[i][j]]); } if((ll)sita.size()>=2||(ll)ue.size()>=2) { cout<<"YES"<