#C問題:鉄道同好会 N,M = map(int,input().split(" ")) array = [[False]*N for i in range(N)] end = 0 count = 0 end_i = [] val = [] def search (i,j): global array global count global end_i count += 1 array[i][j] = False array[j][i] = False for k in range(N): if array[j][k]: tmp = search(j,k) if end_i[1] == tmp or i == tmp: return end_i[1] else: return tmp elif k == N-1: return j for i in range(M): Sa,Sb = map(int,input().split(" ")) array[Sa][Sb] = True array[Sb][Sa] = True #オイラーグラフか半オイラーグラフかの判定 for i in range(N): num = array[i].count(True) if num%2 == 1: end += 1 end_i.append(i) if end >= 3: print("NO") exit(0) if end == 0: end_i.append(Sa) end_i.append(Sa) for i in range(N): if array[end_i[0]][i]: val.append(end_i[1]==search(end_i[0],i)) if all(val) and count == M: print("YES") else: print("NO")