from collections import deque N,M = map(int,input().split()) G = {i:[] for i in range(1,N+1)} for _ in range(M): a,b = map(int,input().split()) G[a].append(b) G[b].append(a) col = [set() for _ in range(N+1)] for i in range(1,N+1): if len(col[i])!=0:continue col[i].add(0) que = deque([i]) while que: x = que.popleft() if len(col[x])==1: s = list(col[x])[0] for y in G[x]: if 1-s not in col[y]: col[y].add(1-s) que.append(y) elif len(col[x])==2: for y in G[x]: if len(col[y])==1: col[y] = set([0,1]) que.append(y) flag = "Yes" for i in range(1,N+1): if len(col[i])<2: flag = "No" break print(flag)