import sys from collections import defaultdict def main(): N, M = map(int, sys.stdin.readline().split()) adj = defaultdict(list) for _ in range(M): a, b = map(int, sys.stdin.readline().split()) adj[a].append(b) adj[b].append(a) # Get neighbors of vertex 1 S = adj[1] if not S: print("NO") return S_set = set(S) # Check each neighbor u of 1 for u in S: # Check all neighbors a of u (excluding 1) for a in adj[u]: if a == 1: continue # Check all neighbors b of a (excluding 1 and u) for b in adj[a]: if b == 1 or b == u: continue # Check all neighbors x of b (excluding 1) for x in adj[b]: if x == 1: continue # Check if x is a neighbor of 1 and distinct from u, a, b if x in S_set and x != u and x != a and x != b: print("YES") return print("NO") if __name__ == "__main__": main()