#include #include #include #include #include #include #include #include #include #include #include #include #define REP(i,n) for(ll i=0;i<(n);i++) #define MOD 1000000007 #define int long long #ifdef int const long long INF = LLONG_MAX / 10; #else const int INF = 1010101010; #endif using namespace std; typedef long long ll; typedef vector> mat; typedef pair P; //typedef pair P; #ifdef LOCAL #define dump(...) \ do { \ std::ostringstream os; \ os << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; \ print_to(os, ", ", "\n", __VA_ARGS__); \ std::cerr << os.str(); \ } while (0) #define dump_(a) \ do { \ std::ostringstream os; \ os << __LINE__ << ":\t" << #a << " = ["; \ print_to_(os, ", ", "]\n", all(a)); \ std::cerr << os.str(); \ } while (0) #else #define dump(...) #define dump_(...) #endif template void print_to(std::ostream &os, const char *, const char *tail, const T &fst) { os << fst << tail; } template void print_to(std::ostream &os, const char *del, const char *tail, const Fst &fst, const Rst &... rst) { os << fst << del; print_to(os, del, tail, rst...); } template void print_to_(std::ostream &os, const char *del, const char *tail, Iter bgn, Iter end) { for (Iter it = bgn; it != end;) { os << *it; if (++it != end) { os << del; } else { os << tail; } } } template void println(const Fst &fst, const Rst &... rst) { print_to(std::cout, "\n", "\n", fst, rst...); } template void print(const Fst &fst, const Rst &... rst) { print_to(std::cout, " ", "\n", fst, rst...); } template void println_(Iter bgn, Iter end) { print_to_(std::cout, "\n", "\n", bgn, end); } template void print_(Iter bgn, Iter end) { print_to_(std::cout, " ", "\n", bgn, end); } // const int MOD = 1000000007; namespace trush { int _ = (std::cout.precision(10), std::cout.setf(std::ios::fixed), std::cin.tie(0), std::ios::sync_with_stdio(0), 0); } //UnionFind!!! class UnionFind { private: vector par; vector myRank; vector cnt; public: //n要素で初期化 UnionFind(int n) { par.resize(n); myRank.resize(n); cnt.resize(n); REP(i,n) { par[i] = i; myRank[i] = 0; cnt[i] = 1; } } //木の根を求める int find(int x) { if (par[x] == x) return x; else return par[x] = find(par[x]); } //xとyの属する集合を併合 void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (myRank[x] < myRank[y]) { par[x] = y; cnt[y] += cnt[x]; } else { par[y] = x; cnt[x] += cnt[y]; if (myRank[x] == myRank[y]) myRank[x]++; } } //xとyが同じ集合に属するか否か bool same(int x, int y) { return find(x) == find(y); } //xが含まれる集合の要素数 int count(int x) { return cnt[find(x)]; } }; int N, M; int Sa, Sb; int degree[510]; signed main() { cin >> N >> M; UnionFind uf(N); int vNum = 0; REP(i,M) { cin >> Sa >> Sb; uf.unite(Sa, Sb); if (degree[Sa] == 0) vNum++; degree[Sa]++; if (degree[Sb] == 0) vNum++; degree[Sb]++; } int oddNum = 0; REP(i,N) if (degree[i] % 2 == 1) oddNum++; if (uf.count(Sa) == vNum && (oddNum == 0 || oddNum == 2)) { cout << "YES" << endl; } else { cout << "NO" << endl; } }