#include using namespace std; typedef long long ll; int main() { int n,m; cin>>n>>m; int a[n]; for (int i=0;i>a[i]; vector g[n]; for (int i=0;i>v>>u; v--,u--; g[v].push_back(u); g[u].push_back(v); } for (int i=0;i up,dwn; for (int u:g[i]) { if (a[u]>a[i]) up.insert(a[u]); else if (a[u]=2 || dwn.size()>=2) { puts("YES"); return 0; } } puts("NO"); return 0; }