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 = [[] for _ in range(N+1)] for i in range(1,N+1): if len(col[i])!=0:continue col[i].append(0) que = deque([i]) while que: x = que.popleft() if len(col[x])==1: s = col[x][0] for y in G[x]: if 1-s not in col[y]: col[y].append(1-s) que.append(y) elif len(col[x])==2: for y in G[x]: if len(col[y])==1: col[y] = [0,1] que.append(y) flag = "Yes" for i in range(1,N+1): if len(col[i])<2: flag = "No" break print(flag)