#include #include #include #include #include #include #include #include #include #include #include #define rep(i,n) for(int i=0;i=0;i--) #define FOR(i,a,b) for(int i=a;i>n>>m; vector> s(n); int a,b; rep(i,m){ cin>>a>>b; s[a].push_back(b); s[b].push_back(a); } //連結 vector check(n); rep(i,n){ check[i]=-1; } a=0; b=0; int aa=1; while(aa){ stack sta; sta.push(a); check[a]=b; while(sta.empty()==0){ int x=sta.top(); sta.pop(); rep(i,s[x].size()){ if(check[s[x][i]]==-1){ sta.push(s[x][i]); check[s[x][i]]=b; } } } b++; rep(i,n){ if(check[i]==-1){ a=i; break; } if(i==n-1){ aa=0; } } } vector y(n); rep(i,n){ y[i]=0; } rep(i,n){ y[check[i]]++; } int z=0; rep(i,y.size()){ if(y[i]>1 && z==0){ z=1; }else if(y[i]>1 && z==1){ cout<<"NO"<2){ cout<<"NO"<