#include using namespace std; typedef long long ll; typedef vector vint; typedef pair pint; typedef vector vpint; #define rep(i,n) for(int i=0;i<(n);i++) #define REP(i,n) for(int i=n-1;i>=(0);i--) #define reps(i,f,n) for(int i=(f);i<(n);i++) #define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++) #define all(v) (v).begin(),(v).end() #define eall(v) unique(all(v), v.end()) #define pb push_back #define mp make_pair #define fi first #define se second #define chmax(a, b) a = (((a)<(b)) ? (b) : (a)) #define chmin(a, b) a = (((a)>(b)) ? (b) : (a)) const int MOD = 1e9 + 7; const int INF = 1e9; const ll INFF = 1e18; int Sa[300000], Sb[300000]; int memo[10100]; class DisjointSet{ public: vector rank, p;//rank:木の高さ p:親の頂点番号 DisjointSet(){} DisjointSet(int size){//頂点の数 rank.resize(size, 0); p.resize(size, 0); rep(i, size) makeSet(i); } bool same(int x, int y){ //同じ木にあるか return findSet(x) == findSet(y); } void unite(int x, int y){ // 木どうしをくっつける link(findSet(x), findSet(y)); } private: void makeSet(int x){ p[x] = x; rank[x] = 0; } int findSet(int x){ //親を探す(ルートまで) if(x != p[x]){ p[x] = findSet(p[x]); } return p[x]; } void link(int x, int y){ //木の高さを考慮して木どうしをくっつける if(rank[x] > rank[y]){ p[y] = x; }else{ p[x] = y; if(rank[x] == rank[y]) rank[y]++; } } }; set se[10100]; int main(void) { int N, M; cin >> N >> M; rep(i, M) cin >> Sa[i] >> Sb[i]; rep(i, M) se[Sa[i]].insert(2 * i), se[Sb[i]].insert(2 * i + 1); // 連結か見る DisjointSet uf(100010); rep(i, N) uf.unite(2 * i, 2 * i + 1); rep(i, N) { // printf("i %d\n", i); for(auto u : se[i]) for(auto v : se[i]) { // printf("u %d v %d\n", u, v); uf.unite(u, v); } } bool f = true; rep(i, 2 * M)rep(j, 2 * M) { auto d = uf.same(i, j); // printf("%d %d %d\n", i, j, d); if(!d) f = false; } if(f == false) { printf("NO\n"); return 0; } rep(i, M) memo[Sa[i]]++, memo[Sb[i]]++; int cnt = 0; rep(i, N) if(memo[i] % 2) cnt++; if(cnt == 2) printf("YES\n"); else printf("NO\n"); // printf("YES\n"); return 0; }