import sys input = sys.stdin.readline N,M=map(int,input().split()) EDGE=[] for i in range(M): a,b=map(int,input().split()) a-=1 b-=1 EDGE.append((a,b)) E=[set() for i in range(N)] for a,b in EDGE: E[a].add(b) E[b].add(a) LIST=[] for to in E[0]: for toto in E[to]: if toto!=0: LIST.append((to,toto)) S=[set() for i in range(N)] for to,toto in LIST: S[toto].add(to) for a,b in EDGE: aflag=0 bflag=0 if b in S[a]: aflag=1 S[a].remove(b) if a in S[b]: bflag=1 S[b].remove(a) if len(S[a])==0 or len(S[b])==0: pass elif len(S[a])+len(S[b])>=3: print("YES") exit() else: x=list(S[a])[0] y=list(S[b])[0] if x!=y: print("YES") exit() if aflag==1: S[a].add(b) if bflag==1: S[b].add(a) print("NO")