n, m = map(int, input().split())
a = []
b = []
index = False
for _ in range(m):
    ai, bi = map(int, input().split())
    if bi==1:
        index=True
    a.append(ai)
    b.append(bi)
    
print("NO")