#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;

void IO(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
}

int main(){
  IO();
  ll n,m;
  cin>>n>>m;
  vector<vector<ll>> G(n);
  for(ll i=0;i<m;i++){
    ll a,b;
    cin>>a>>b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  bool ok=true;
  vector<ll> co(n,-1);
  for(ll i=0;i<n;i++){
    if(co[i]==-1){
      co[i]=0;
      queue<ll> que;
      que.push(i);
      while(que.size()){
        ll q=que.front();
        que.pop();
        for(ll u:G[q]){
          if(co[u]==-1){
            co[u]=(co[q]+1)%2;
            que.push(u);
          }else if(co[u]==co[q]){
            ok=false;
          }
        }
      }
    }
  }
  if(ok){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}