//include //------------------------------------------ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //conversion //------------------------------------------ inline long long toint(string s) {long long v; istringstream sin(s);sin>>v;return v;} template inline string toString(T x) {ostringstream sout;sout< inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef long long ll; typedef long long LL; typedef vector vi; typedef vector VLL; typedef vector vll; typedef vector ves; typedef vector vech; typedef pair pll; typedef pair PLL; typedef mapmll; typedef mapmii; typedef mapmci; typedef mapmcl; typedef vector > vpll; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define VECMAX(x) *max_element(ALL(x)) #define VECMIN(x) *min_element(ALL(x)) #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(long long i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //#define MULTIPLE(i,n,k) for(int i = (k) ; i<(n) ; i+=k+1)//倍数ループ //constant //------------------------------------------ const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) //debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #define SIZEOF(x) sizeof(x)/sizeof(x[0]) const long long INF = 4e18; const long long NINF = 1 - INF; #define ENDL cout << endl; #define CIN(a) REP(i,a.size())cin >> a[i]; //二次元座標の点を表す構造体。xとyをメンバに持つ struct POINT{ double x; double y; }; //最小公倍数、最大公約数 ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; } /* nCr , 値が大きいとオーバーフローする n<=kなら1 (0C1や1C5= 1) */ ll nCr(ll n, ll r){ if ( r * 2 > n ) r = n - r; ll dividend = 1; ll divisor = 1; for ( unsigned int i = 1; i <= r; ++i ) { dividend *= (n-i+1); divisor *= i; } return dividend / divisor; } int main(){ ll n , m;cin >> n >> m; vectorG(n+1); REP(i,m){ ll a , b;cin >> a >> b; G[a].push_back(b); G[b].push_back(a); } bool ok = true; vll memo(n+1,-1); REP(i,n+1){ if(memo[i] != -1)continue; ll r = i; stack s; s.push(r); memo[r] = 0; while(!s.empty()){ ll now = s.top(); s.pop(); for(ll nx : G[now]){ if(memo[nx] != -1){ if(memo[nx] == memo[now]){ ok = false; break; } continue; } memo[nx] = memo[now]^1; s.push(nx); } } } if(ok)cout << "Yes" << endl; else cout << "No" << endl; return 0; }