R=range J=lambda:map(int,input().split()) N,M=J() N+=1 p=[i for i in R(N*2)] def r(i): while i!=p[i]:i=p[i] return i for i in R(M): A,B=J() C,D=r(A),r(B+N) p[C]=D C,D=r(A+N),r(B) p[C]=D print("YNeos"[any(r(i)==r(i+N)for i in R(N))::2])