import sys input = sys.stdin.readline N,M=map(int,input().split()) E=[set() for i in range(N)] L=[] for i in range(M): a,b=map(int,input().split()) a-=1 b-=1 if a==0: L.append(b) elif b==0: L.append(a) else: E[a].add(b) E[b].add(a) for i in range(len(L)): a=L[i] for j in range(i+1,len(L)): b=L[j] if a & b != set(): print("YES") exit() print("NO")