You are given a [directed graph](https://en.wikipedia.org/wiki/Directed_graph) consisting of n vertices and m edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most one edge from it.

Can you make this graph [acyclic](https://en.wikipedia.org/wiki/Directed_acyclic_graph) by removing at most one edge from it? A directed graph is called acyclic iff it doesn't contain any cycle (a non-empty path that starts and ends in the same vertex).

Input

The first line contains two integers n and m (2 ≤ n ≤ 500, 1 ≤ m ≤ min(n(n - 1), 100000)) — the number of vertices and the number of edges, respectively.

Then m lines follow. Each line contains two integers u and v denoting a directed edge going from vertex u to vertex v (1 ≤ u, v ≤ n, u ≠ v). Each ordered pair (u, v) is listed at most once (there is at most one directed edge from u to v).

Output

If it is possible to make this graph acyclic by removing at most one edge, print YES. Otherwise, print NO.

Examples

Input

3 4
1 2
2 3
3 2
3 1


Output

YES


Input

5 6
1 2
2 3
3 2
3 1
2 1
4 5


Output

NO

Note

In the first example you can remove edge <image>, and the graph becomes acyclic.

In the second example you have to remove at least two edges (for example, <image> and <image>) in order to make the graph acyclic.
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
    long MOD = 1000000007L;
    public class Obj implements Comparable<Obj>{
        public int t;
        public int h;
        
        public Obj(int t_, int h_){
            t = t_;
            h = h_;
        }
        
        public int compareTo(Obj other){
            return t - other.t;
        }
        
    }
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
        Codechef cf = new Codechef();
        cf.Solve();
	}
	
	ArrayList<ArrayList<Integer>> con;
	int[][] arr;
	boolean[] vis, stack;
	Stack<Integer> st, end;
	public void Solve(){
        MyScanner sc = new MyScanner();
        int n = sc.nextInt();
        int m = sc.nextInt();
        con = new ArrayList<ArrayList<Integer>>();
        for (int i = 0; i < n; ++i){
            con.add(new ArrayList<Integer>());
        }
        
        arr = new int[n][n];
        for (int i = 0; i < m; ++i){
            int u = sc.nextInt();
            int v = sc.nextInt();
            u--;
            v--;
            con.get(u).add(v);
            arr[u][v] = 1;
        }
        // System.out.println(con);
        vis = new boolean[n];
        stack = new boolean[n];
	    for (int i = 0; i < n; ++i){
	        if (!vis[i]){
	           st = new Stack<Integer>();
                end = new Stack<Integer>();
                boolean cycle = DFS(i);
                // System.out.println(cycle);
                if (cycle){
                    if (!checkCycle(n, m)){
                        System.out.println("NO");
                        return;
                    }else{
                        System.out.println("YES");
                        return;
                    }
                }
	        }

	    }
	    System.out.println("YES");
	}
	
	public boolean checkCycle(int n, int m){
	   // System.out.println("Stack size: " + st.size());
	    while (!st.isEmpty()){
            int u = st.pop();
            int v = end.pop();
            arr[u][v] = 0;
            // System.out.println("remove edge: " + u + " " + v);
            vis = new boolean[n];
            boolean noCycle = true;
            for (int i = 0; i < n; ++i){
                if (!vis[i])
                    noCycle &= DFS2(i);
            }
            // System.out.println("cycleCheck: " + noCycle);
            if (noCycle){
                return true;
            }
            arr[u][v] = 1;
        }
        return false;
	}
	
	public boolean DFS(int cur){
	    vis[cur] = true;
	    stack[cur] = true;
	    
	    ArrayList<Integer> co = con.get(cur);
	    for (int v : co){
	        if (arr[cur][v] != 0){
	            if (vis[v]){
	                if (stack[v]){
	                    st.add(cur);
	                    end.add(v);
	                    return true;
	                }
	            }
	            else{
	                st.add(cur);
	                end.add(v);
	                boolean ok = DFS(v);
	                
	                if (!ok){
	                    st.pop();
	                    end.pop();
	                }else{
	                    return true;
	                }
	            }
	        }
	    }
	    stack[cur] = false;
	    return false;
	}
	
	public boolean DFS2(int cur){
	   // System.out.println("Cur: " + cur);
	    vis[cur] = true;
	    stack[cur] = true;
	    ArrayList<Integer> co = con.get(cur);
	   // System.out.println(co);
	    for (int v : co){
	       // System.out.println(" cur: " + cur + " v: " + v + " " + arr[cur][v]);
	        if (arr[cur][v] != 0){
	           // System.out.println("edge: " + cur + " " + v);
	            if (vis[v]){
	               // System.out.println(cur + " v: " + v + " " + stack[v]);
	                if (stack[v]) return false;
	            }
	            else{
	                boolean ok = DFS2(v);
	                if (!ok){
	                    return false;
	                }
	            }
	        }
	    }
	    stack[cur] = false;
	    return true;
	}

	//-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;
      
   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }
 
      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
      try {
         str = br.readLine();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return str;
      }

   }
}