#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v.begin(), v.end()) #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template ostream& operator << (ostream &s, pair P) { return s << '<' << P.first << ", " << P.second << '>'; } template ostream& operator << (ostream &s, vector P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template ostream& operator << (ostream &s, vector > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template ostream& operator << (ostream &s, set P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template ostream& operator << (ostream &s, map P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } typedef long long ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) const int nmax=510; bool vis[nmax]; vectorw[nmax]; void dfs(int v){ vis[v]=true; for(int i : w[v]){ if(!vis[i]){ dfs(i); } } } int main() { int n,m; cin>>n>>m; int start=-1; vectordeg(n,0); for(int i=0;i>a>>b; w[a].push_back(b); w[b].push_back(a); deg[a]++; deg[b]++; start=a; } dfs(start); int cnt=0; for(int i=0;i2 || (!vis[i] && deg[i]>0)) { cout<<"NO"<