package No400番台; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { solver(); } static void solver() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList[] e = new ArrayList[n]; for (int i = 0; i < n; i++) { e[i] = new ArrayList<>(); } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; e[a].add(b); e[b].add(a); } boolean[] arrived=new boolean[n]; dfs(0,0,arrived,0,e); System.out.println("NO"); } static void dfs(int root, int p, boolean[] arrived, int depth, ArrayList[] e) { if (depth == 4) { for (int v : e[p]) { if (root == v) { System.out.println("YES"); System.exit(0); } } } else { for (int v : e[p]) { if (!arrived[v]) { boolean[] d = Arrays.copyOf(arrived, arrived.length); d[v] = true; dfs(root,v,d,depth+1,e); } } } } }