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.io.*;
import java.math.*;
public class Code{
    
    static int a;
    static int b;
    
    static class Node{ 
        int id;
        LinkedList<Integer> neighbers = new LinkedList<Integer>();
        public Node(int id){
            this.id = id;
        }
    }
    
    static Node[] node;
    

    static boolean[] visited;
    static boolean[] recStack;
    
    static boolean isCyclic(int n){
        
        Arrays.fill(visited,false);
        Arrays.fill(recStack,false);
        
        for(int i=1;i<=n;i++){
            if(isCyclicUtil(i)) return true;
        }
        return false;
        
    }
    
    static int isCyclicNode(int n){
        
        for(int i=1;i<=n;i++){
            Arrays.fill(visited,false);
            if(bfs(i)) return i;
        }
        return 0;
    }
    
    static boolean bfs(int first){
        
        LinkedList<Integer> next = new LinkedList<Integer>();
        next.add(first);
        visited[first] = true;
        while(!next.isEmpty()){
            
            int id = next.poll();
            for(int i:node[id].neighbers){
                if(i==first) return true;
                if(visited[i]) continue;
                visited[i] = true;
                next.add(i);
            }
            
        }
        
        return false;
        
    }
    
    static boolean isCyclicUtil(int i){
        if(recStack[i]) return true;
        if(visited[i]) return false;
        visited[i] = true;
        recStack[i] = true;
        
        for(int c:node[i].neighbers){
            if(i==a && c==b) continue;
            if(isCyclicUtil(c)) return true;
        }
        recStack[i] = false;
        return false;
    }
    
    static class Road{
        int f;
        int s;
        Road(int f,int s){
            this.f = f;
            this.s = s;
        }
    }
    
    static int[] pr;
    
    static void remplirRoad(LinkedList<Road> r,int n){
        
        LinkedList<Integer> next = new LinkedList<Integer>();
        int first = isCyclicNode(n);
        Arrays.fill(visited,false);
        //System.out.println(first);
        if(first == 0) return ;
        boolean end = false;
        next.add(first);
        visited[first] = true;
        //boolean cycle = false;
        while(!next.isEmpty()){
            
            int id = next.poll();
            //System.out.println(id);
            for(int i:node[id].neighbers){
                //System.out.println("    "+i+" "+visited[i]);
                if(i==first){
                    
                    pr[i] = id;
                    end = true;
                    break;
                    
                }
                if(visited[i]) continue;
                visited[i] = true;
                pr[i] = id;
                next.add(i);
                
            }
            if(end) break;
            
        }
        if(!end) return ;
        int id = first;
        LinkedList<Integer> path = new LinkedList<Integer>();
        path.add(first);
        
        while(pr[id]!=first){
            id = pr[id];
            path.addFirst(id);
        }
        
        path.addFirst(first);
        
        boolean ok = true;
        int precedant = 0;
        for(int i:path){
            
            if(ok){
                ok = false;
                precedant = i;
            }else{
                
                r.add(new Road(precedant,i));
                precedant = i;
                
            }
            
        }
        
       // for(Road road:r){
       //     System.out.println(road.f+" "+road.s);
      //  }
        
    }
    
    
    public static void main(String[] args)throws IOException{
                
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        //PrintWriter out = new PrintWriter(System.out);
        
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());
        
        node = new Node[n+1];
        for(int i=1;i<=n;i++) node[i] = new Node(i);
        
        LinkedList<Road> r = new LinkedList<Road>();
        
        for(int i=0;i<m;i++){
            st = new StringTokenizer(br.readLine());
            int u = Integer.parseInt(st.nextToken());
            int v = Integer.parseInt(st.nextToken());

            //r.add(new Road(u,v));
            node[u].neighbers.add(v);
        }
        
        
        
        visited = new boolean[n+1];
        recStack = new boolean[n+1];
        pr = new int[n+1];
        
        remplirRoad(r,n);

        boolean ok = isCyclic(n);
        //a = 0;
        //b = 0;
        //System.out.println(isCyclic(n));
        
        for(Road road:r){
            a = road.f;
            b = road.s;
            ok = (ok && isCyclic(n)); 
        }

        if(!ok) System.out.println("YES");
        else System.out.println("NO");
        
        //out.flush();
        
    }
    
}