#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define i_7 (ll)(1E9+7) #define i_5 (ll)(1E9+5) ll mod(ll a){ ll c=a%i_7; if(c>=0)return c; else return c+i_7; } typedef pair i_i; typedef pair l_l; ll inf=(ll)1E12;/*10^12*/ #define rep(i,l,r) for(ll i=l;i<=r;i++) #define pb push_back ll max(ll a,ll b){if(ab)return b;else return a;} //////////////////////////////////////// bool check(vectorv,vectoru){ sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); sort(u.begin(),u.end()); u.erase(unique(u.begin(),u.end()),u.end()); sets; ll vv=v.size(),uu=u.size(); for(auto x:v)s.insert(x); for(auto x:u)s.insert(x); ll ss=s.size(); return ss==vv+uu; } int main(){ int n,m;cin>>n>>m; vectorv[n]; rep(i,0,m-1){ int s,t;cin>>s>>t;s--;t--; v[s].pb(t); v[t].pb(s); } vectorv0,v1,v2; for(auto x:v[0])v0.pb(x); for(auto x:v0){ for(auto y:v[x])v1.pb(y); } sort(v1.begin(),v1.end()); v1.erase(unique(v1.begin(),v1.end()),v1.end()); for(auto x:v1){ for(auto y:v[x])v2.pb(y); } if(!check(v1,v2)){ cout<<"YES"<