def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 M = int(input[idx]) idx += 1 adj = [set() for _ in range(N + 1)] # 1-based for _ in range(M): a = int(input[idx]) idx += 1 b = int(input[idx]) idx += 1 adj[a].add(b) adj[b].add(a) # Collect neighbors of 1 S = list(adj[1]) if len(S) < 2: print("NO") return # Check all pairs u, v in S where u < v for i in range(len(S)): u = S[i] for j in range(i + 1, len(S)): v = S[j] # Check all a in adj[u] for a in adj[u]: if a == 1 or a == u or a == v: continue # Compute common between adj[a] and adj[v] common = adj[a] & adj[v] if not common: continue # Remove 1, u, v, a from common common.discard(1) common.discard(u) common.discard(v) common.discard(a) if common: print("YES") return print("NO") if __name__ == "__main__": main()