import sys
MAX = 100010
N,M = map(int, sys.stdin.readline().split())
graph=[[] for _ in range(MAX)]
check = [False] *(MAX)
board = [[0] for _ in range(MAX)]
flag= False
def dfs(node, color):
global flag
check[node] = True
board[node] = color
if color ==1:
other = 2
else:
other = 1
for adj in graph[node]:
next_node = adj
if board[next_node] ==color:
flag = True
return flag
if check[next_node]==False:
dfs(next_node, other)
return flag
for i in range(M):
a, b = map(int, sys.stdin.readline().split())
graph[a].append(b)
graph[b].append(a)
dfs(0,1)
if flag == False:
print('YES')
else:
print('NO')