package No400番台; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; 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 ans = false; for (int i = 0; i < 200; i++) { Random rand = new Random(); int[] col = new int[n]; Arrays.fill(col, -1); for (int j = 1; j < n; j++) { col[j] = rand.nextInt(4); } boolean[][] dp = new boolean[1 << 4][n]; dp[0][0] = true; for (int s = 0; s < (1 << 4) - 1; s++) { for (int v = 0; v < n; v++) { if (dp[s][v]) { for (int u : e[v]) { if (u != 0) { int t = s | (1 << col[u]); if (t > s) { dp[t][u] = true; } } } } } } for (int j = 1; j < n; j++) { if (dp[(1 << 4) - 1][j]) { for (int v : e[j]) { if (v == 0) { ans = true; } } } } } System.out.println(ans ? "YES" : "NO"); } }