import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java.util.Set; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int M = sc.nextInt(); ArrayList> adj = new ArrayList>(); for(int i = 0; i < N; i++){ adj.add(new HashSet()); } for(int i = 0; i < M; i++){ final int A = sc.nextInt() - 1; final int B = sc.nextInt() - 1; adj.get(A).add(B); adj.get(B).add(A); } //System.out.println(adj); ArrayList> to_1 = new ArrayList>(); for(int i = 0; i < N; i++){ to_1.add(new HashSet()); } for(int i = 1; i < N; i++){ for(final int j : adj.get(i)){ if(adj.get(j).contains(0)){ to_1.get(i).add(j); } } } //System.out.println(to_1); for(int fst = 1; fst < N; fst++){ for(final int snd : adj.get(fst)){ final HashSet fst_to_1 = new HashSet(to_1.get(fst)); final HashSet snd_to_1 = new HashSet(to_1.get(snd)); fst_to_1.remove(snd); snd_to_1.remove(fst); //System.out.println(fst_to_1 + " " + snd_to_1); if(fst_to_1.isEmpty() || snd_to_1.isEmpty()){ continue; } if(!fst_to_1.equals(snd_to_1)){ System.out.println("YES"); return; } } } System.out.println("NO"); return; } public static class Scanner implements Closeable { private BufferedReader br; private StringTokenizer tok; public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is)); } private void getLine() throws IOException { while (!hasNext()) { tok = new StringTokenizer(br.readLine()); } } private boolean hasNext() { return tok != null && tok.hasMoreTokens(); } public String next() throws IOException { getLine(); return tok.nextToken(); } public int nextInt() throws IOException { return Integer.parseInt(next()); } public long nextLong() throws IOException { return Long.parseLong(next()); } public double nextDouble() throws IOException { return Double.parseDouble(next()); } public void close() throws IOException { br.close(); } } }