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.
//package practice.pset1;

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class R915D {

    static int[][] adj;
    static int n, vid;
    static int[] vis;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);

        n = sc.nextInt();
        vis = new int[n];
        int m = sc.nextInt();
        int[] from = new int[m];
        int[] to = new int[m];
        for (int i = 0; i < m; i++) {
            from[i] = sc.nextInt()-1;
            to[i] = sc.nextInt()-1;
        }

        adj = packD(n, from, to);

        list = new ArrayList<>();
        cycleList = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if(vis[i] == 0 && !cycle)
                findCycle(i);
        }

        if(!cycle){
            System.out.println("YES");
            return;
        }
        for (int i = 0; i < cycleList.size()-1; i++) {
            Arrays.fill(vis, 0);
            boolean nocycle = true;
            for (int j = 0; j < n; j++) {
                if(vis[j] == 0)
                    nocycle &= nocycle(j, i);
            }
            if(nocycle)
            {
                System.out.println("YES");
                return;
            }
        }

        System.out.println("NO");

        pw.flush();
        pw.close();
    }
    static ArrayList<Integer> list;
    static boolean cycle = false;
    static ArrayList<Integer> cycleList;

    static void findCycle(int u){
        vis[u] = 1;
        list.add(u);
        for (int v:adj[u]) {
            if(vis[v] == 0){
                findCycle(v);
            }else if(vis[v] == 1){
                if(!cycle){
                    cycle = true;
                    int lastPos = -1;
                    for (int i = 0; i < list.size(); i++) {
                        if(list.get(i) == v)
                            lastPos = i;
                    }

                    for (int i = lastPos; i < list.size(); i++)
                        cycleList.add(list.get(i));
                    cycleList.add(v);
                }
            }
        }
        vis[u] = 2;
        list.remove(list.size()-1);
    }

    static boolean nocycle(int u, int i){
        boolean ret = true;
        vis[u] = 1;
        for (int v:adj[u]) {
            if(u == cycleList.get(i) && v == cycleList.get(i+1))
                continue;
            if(vis[v] == 0){
                ret &= nocycle(v, i);
            }else if(vis[v] == 1){
                ret &= false;
            }
        }
        vis[u] = 2;
        return ret;
    }

    static int[][] packD(int n, int[] from, int[] to) {
        int[][] g = new int[n][];
        int[] p = new int[n];
        for (int f : from) if(f != -1) p[f]++;
        for (int i = 0; i < n; i++) g[i] = new int[p[i]];
        for (int i = 0; i < from.length; i++) if(from[i] != -1) {g[from[i]][--p[from[i]]] = to[i];}
        return g;
    }

    static class Scanner
    {
        StringTokenizer st; BufferedReader br;
        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
        public Scanner(String s) throws FileNotFoundException {	br = new BufferedReader(new FileReader(new File(s)));}
        public String next() throws IOException {while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());return st.nextToken();}
        public int nextInt() throws IOException {return Integer.parseInt(next());}
        public long nextLong() throws IOException {return Long.parseLong(next());}
        public String nextLine() throws IOException {return br.readLine();}
        public boolean ready() throws IOException {return br.ready();}
    }
}
