N, M = map(int, input().split()) edges = [] g = [set() for _ in range(N)] for _ in range(M): A, B = map(int, input().split()) A -= 1 B -= 1 g[A].add(B) g[B].add(A) edges.append((A, B)) e2 = [] for a, b in edges: if a == 0 or b == 0: continue if a in g[0]: e2.append((a, b)) if b in g[0]: e2.append((b, a)) for i, j in e2: for k, l in e2: if i != k and l in g[j]: print("YES") exit() print("NO")