import java.io.*; import java.util.*; public class Main_yukicoder408_1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Printer pr = new Printer(System.out); int n = sc.nextInt(); int m = sc.nextInt(); @SuppressWarnings("unchecked") Set edges[] = new Set[n]; for (int i = 0; i < n; i++) { edges[i] = new HashSet<>(); } // int[] a = new int[m]; // int[] b = new int[m]; for (int i = 0; i < m; i++) { // a[i] = sc.nextInt() - 1; // b[i] = sc.nextInt() - 1; int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; // edges[a[i]].add(b[i]); // edges[b[i]].add(a[i]); edges[a].add(b); edges[b].add(a); } Set[] edges2 = new Set[n]; for (int i = 1; i < n; i++) { edges2[i] = new HashSet<>(); } for (int e : edges[0]) { for (int e2 : edges[e]) { if (e2 != 0) { edges2[e2].add(e); } } } // for (int i = 0; i < m; i++) { for (int i = 1; i < n; i++) { for (int j : edges[i]) { if (j == 0) { continue; } for (int e : edges2[i]) { if (e == 0) { continue; } for (int e2 : edges2[j]) { if (e2 == 0) { continue; } if (e != e2 && e != j && e2 != i) { pr.println("YES"); pr.close(); sc.close(); return; } } } /* if (a[i] == 0 || b[i] == 0) { continue; } for (int e : edges2[a[i]]) { if (e == 0) { continue; } for (int e2 : edges2[b[i]]) { if (e2 == 0) { continue; } if (e != e2 && e != b[i] && e2 != a[i]) { pr.println("YES"); pr.close(); sc.close(); return; } } */ } } pr.println("NO"); pr.close(); sc.close(); } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Iterator it; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in), 128); } String next() throws RuntimeException { try { if (it == null || !it.hasNext()) { // it = Arrays.asList(br.readLine().split(" ")).iterator(); it = Arrays.asList(br.readLine().split("\\p{javaWhitespace}+")).iterator(); } return it.next(); } catch (IOException e) { throw new IllegalStateException(); } } int nextInt() throws RuntimeException { return Integer.parseInt(next()); } long nextLong() throws RuntimeException { return Long.parseLong(next()); } float nextFloat() throws RuntimeException { return Float.parseFloat(next()); } double nextDouble() throws RuntimeException { return Double.parseDouble(next()); } void close() { try { br.close(); } catch (IOException e) { // throw new IllegalStateException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }