N,M = map(int,raw_input().split()) E = [[] for i in xrange(N)] for i in xrange(M): A,B = map(lambda x:int(x)-1,raw_input().split()) E[A].append(B) E[B].append(A) for i in xrange(N): E[i].sort() def check(gone,nxt): while gone: if gone % 10000 == nxt: return True gone /= 10000 return False def dfs(h,gone,num): if num == 5: if E[h][0] == 0: print "YES" quit() else: for nxt in E[h]: if check(gone,nxt+1): continue dfs(nxt,gone*10000+nxt+1,num+1) dfs(0,1,1) print "NO"