#include using namespace std; #define vi vector #define vvi vector #define vs vector #define pb push_back #define P pair #define vp vector

#define PP pair #define vpp vector #define fi first #define se second #define INF 1e9 #define MOD 1000000007 #define REP(i,n) for(int i=0;i=0;i--) #define FOR(i,m,n) for(int i=m;ivec[vis[2]]){ return true; } if(vec[vis[0]]>vec[vis[1]]&&vec[vis[1]]>V>>E; vec.resize(V); REP(i,V){ cin>>vec[i]; vec[i]--; } G.resize(V); REP(i,E){ int a,b; cin>>a>>b; a--;b--; G[a].pb(b); G[b].pb(a); } vi temp; if(dfs(temp)){ cout<<"YES"<