N,M = map(int,input().split()) station = [] for i in range(M): s,t = map(int,input().split()) station.remove(s) if s in station else station.append(s) station.remove(t) if t in station else station.append(t) print("YES" if len(station)<=2 else "NO")