#include #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; int n = 505; vector> train(n,vector()); vector seen(n,false); bool ok = true; void dfs(int i,int p=-1){ seen[i] = true; if(train[i].size() > 2) ok = false; for(int c:train[i]){ if(c==p) continue; if(seen[c]) continue; dfs(c,i); } } int main(){ int m; cin >> n >> m; vector station(n,false); int first = -1; rep(i,m){ int a,b; cin >> a >> b; train[a].push_back(b); train[b].push_back(a); station[a] = true; station[b] = true; first = a; } dfs(first); if(!ok){ cout << "NO" << endl; return 0; } else{ rep(i,n){ if(station[i] && !seen[i]){ cout << "NO" << endl; return 0; } } } cout << "YES" << endl; return 0; }