#include using namespace std; #define LOCAL #pragma region Macros typedef long long ll; #define ALL(x) (x).begin(),(x).end() const long long MOD=1000000007; // const long long MOD=998244353; const int INF=1e9; const long long IINF=1e18; const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1}; const char dir[4]={'D','R','U','L'}; template istream &operator>>(istream &is,vector &v){ for (T &x:v) is >> x; return is; } template ostream &operator<<(ostream &os,const vector &v){ for (int i=0;i ostream &operator<<(ostream &os,const pair &p){ os << '(' << p.first << ',' << p.second << ')'; return os; } template ostream &operator<<(ostream &os,const map &m){ os << '{'; for (auto itr=m.begin();itr!=m.end();++itr){ os << '(' << itr->first << ',' << itr->second << ')'; if (++itr!=m.end()) os << ','; --itr; } os << '}'; return os; } template ostream &operator<<(ostream &os,const set &s){ os << '{'; for (auto itr=s.begin();itr!=s.end();++itr){ os << *itr; if (++itr!=s.end()) os << ','; --itr; } os << '}'; return os; } void debug_out(){cerr << '\n';} template void debug_out(Head&& head,Tail&&... tail){ cerr << head; if (sizeof...(Tail)>0) cerr << ", "; debug_out(move(tail)...); } #ifdef LOCAL #define debug(...) cerr << " ";\ cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\ cerr << " ";\ debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif template T gcd(T x,T y){return y!=0?gcd(y,x%y):x;} template T lcm(T x,T y){return x/gcd(x,y)*y;} template inline bool chmin(T1 &a,T2 b){ if (a>b){a=b; return true;} return false; } template inline bool chmax(T1 &a,T2 b){ if (a struct EulerianTrail{ vector>> G; vector> BG; vector> es; vector used,visited,deg; EulerianTrail(int n):G(n),BG(n),visited(n,0),deg(n,0){} void add_edge(int u,int v){ int m=es.size(); es.emplace_back(u,v); used.emplace_back(0); BG[u].emplace_back(v); BG[v].emplace_back(u); G[u].emplace_back(v,m); ++deg[u]; if (directed) --deg[v]; else G[v].emplace_back(u,m),++deg[v]; } void dfs(int v,int &s,int &t,int &check){ visited[v]=1; if (directed){ if (abs(deg[v])>1) check=0; else if (deg[v]==1){ if (~s) check=0; else s=v; } } else { if (deg[v]&1){ if (s<0) s=v; else if (t<0) t=v; else check=0; } } for (int u:BG[v]){ if (visited[u]) continue; dfs(u,s,t,check); } } vector go(int s){ stack> st; vector ord; st.emplace(s,-1); while(!st.empty()){ int v=st.top().first; visited[v]=1; if (G[v].empty()){ ord.emplace_back(st.top().second); st.pop(); } else { auto e=G[v].back(); G[v].pop_back(); if (used[e.second]) continue; used[e.second]=1; st.emplace(e); } } ord.pop_back(); reverse(ord.begin(),ord.end()); return ord; } vector> build(){ for (int i=0;i> res; for (int i=0;i> build_semi(){ vector> res; for (int i=0;i operator[](int i){return es[i];} }; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N,M; cin >> N >> M; EulerianTrail ET(N); for (int i=0;i> a >> b; ET.add_edge(a,b); } cout << (ET.build_semi().size()==1?"YES":"NO") << '\n'; }