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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author caoash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DAlmostAcyclicGraph solver = new DAlmostAcyclicGraph();
        solver.solve(1, in, out);
        out.close();
    }

    static class DAlmostAcyclicGraph {
        static int n;
        static int m;
        static ArrayList<Integer>[] adj;
        static int[] p;
        static boolean[] vis1;
        static boolean foundCycle;
        static int cycleStart;
        static int cycleEnd;
        static int[] color;

        public void solve(int testNumber, FastScanner br, PrintWriter pw) {
            n = br.nextInt();
            m = br.nextInt();
            p = new int[n];
            vis1 = new boolean[n];
            color = new int[n];
            foundCycle = false;
            adj = new ArrayList[n];
            for (int i = 0; i < n; i++) adj[i] = new ArrayList<>();
            for (int i = 0; i < m; i++) {
                int u = br.nextInt();
                int v = br.nextInt();
                u--;
                v--;
                adj[u].add(v);
            }
            cycleStart = -1;
            for (int i = 0; i < n; i++) {
                p[i] = -1;
            }
            for (int i = 0; i < n; i++) {
                if (dfs(i)) {
                    break;
                }
            }
            if (cycleStart == -1) {
                pw.println("YES");
                pw.close();
            } else {
                ArrayList<Pair> cycleEdges = new ArrayList<Pair>();
                for (int v = cycleEnd; v != cycleStart; v = p[v]) {
                    cycleEdges.add(new Pair(p[v], v));
                }
                cycleEdges.add(new Pair(cycleEnd, cycleStart));
                for (Pair p : cycleEdges) {
//                pw.println(p.f + " " + p.s);
                    for (int i = 0; i < n; i++) {
                        color[i] = 0;
                    }
                    cycleStart = -1;
                    cycleEnd = 0;
                    for (int i = 0; i < n; i++) {
                        if (dfsIgnoreEdge(i, p)) {
                            break;
                        }
                    }
                    if (cycleStart == -1) {
                        pw.println("YES");
                        pw.close();
                        break;
                    }
                }
                pw.println("NO");
            }
            pw.close();
        }

        public static boolean dfs(int v) {
            color[v] = 1;
            for (int u : adj[v]) {
//            System.out.println(v +" " + u + " " + color[u]);
                if (color[u] == 0) {
                    p[u] = v;
                    if (dfs(u)) {
                        return true;
                    }
                } else if (color[u] == 1) {
                    cycleEnd = v;
                    cycleStart = u;
                    return true;
                }
            }
            color[v] = 2;
            return false;
        }

        public static boolean dfsIgnoreEdge(int v, Pair ed) {
            color[v] = 1;
            for (int u : adj[v]) {
                if (v == ed.f && u == ed.s) {
                    continue;
                }
//            System.out.println(v +" " + u + " " + color[u]);
                if (color[u] == 0) {
                    p[u] = v;
                    if (dfsIgnoreEdge(u, ed)) {
                        return true;
                    }
                } else if (color[u] == 1) {
                    cycleEnd = v;
                    cycleStart = u;
                    return true;
                }
            }
            color[v] = 2;
            return false;
        }

        public class Pair {
            int f;
            int s;

            public Pair(int f, int s) {
                this.f = f;
                this.s = s;
            }

        }

    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

