import sys from sys import stdin from collections import defaultdict def main(): input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 M = int(input[idx]) idx += 1 if N < 5: print("NO") return adj = defaultdict(set) for _ in range(M): u = int(input[idx]) idx += 1 v = int(input[idx]) idx += 1 adj[u].add(v) adj[v].add(u) S = adj[1] if not S: print("NO") return # Check for possible 5-cycle for a in S: for b in adj[a]: if b == 1: continue for c in adj[b]: if c == 1 or c == a: continue for d in adj[c]: if d in S and d not in {a, b, c}: print("YES") return print("NO") if __name__ == "__main__": main()