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

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

    static class TaskD {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            List<Integer>[] g = GraphUtils.nextD(in, n, m, true);
            if (getCycle(g) == null) {
                out.println("YES");
                return;
            }
            int[] cycle = getCycle(g);
            for (int i = 0, size = cycle.length; i < size; ++i) {
                int cur = cycle[i];
                int next = cycle[(i + 1) % size];
                if (getCycle(g, cur, next) == null) {
                    out.println("YES");
                    return;
                }
            }
            out.println("NO");
        }

        public static int[] getCycle(List<Integer>[] g, int start, int end) {
            int n = g.length;
            boolean[] visited = new boolean[n];
            for (int i = 0; i < n; ++i) {
                if (visited[i]) continue;
                int[] stack = new int[n << 1];
                int[] idx = new int[n];
                boolean[] inc = new boolean[n];
                int ptr = 0;
                stack[ptr++] = i;

                outer:
                while (ptr != 0) {
                    int cur = stack[ptr - 1];
                    inc[cur] = true;
                    visited[cur] = true;
                    while (idx[cur] < g[cur].size()) {
                        int next = g[cur].get(idx[cur]++);
                        if (cur == start && next == end) continue;
                        stack[ptr++] = next;
                        if (inc[next]) {
                            stack = Arrays.copyOf(stack, ptr);
                            return stack;
                        }
                        continue outer;
                    }
                    --ptr;
                    inc[cur] = false;
                }
            }
            return null;
        }

        public static int[] getCycle(List<Integer>[] g) {
            int n = g.length;
            boolean[] visited = new boolean[n];
            for (int i = 0; i < n; ++i) {
                if (visited[i]) continue;
                int[] stack = new int[n << 1];
                int[] idx = new int[n];
                boolean[] inc = new boolean[n];
                int ptr = 0;
                stack[ptr++] = i;

                outer:
                while (ptr != 0) {
                    int cur = stack[ptr - 1];
                    inc[cur] = true;
                    visited[cur] = true;
                    while (idx[cur] < g[cur].size()) {
                        int next = g[cur].get(idx[cur]++);
                        stack[ptr++] = next;
                        if (inc[next]) {
                            stack = Arrays.copyOf(stack, ptr);
                            return stack;
                        }
                        continue outer;
                    }
                    --ptr;
                    inc[cur] = false;
                }
            }
            return null;
        }

    }

    static class GraphUtils {
        public static List<Integer>[] nextD(FastReader in, int n, int m, boolean oneIndexed) {
            List<Integer>[] g = new List[n];
            for (int i = 0; i < n; ++i) g[i] = new ArrayList<>();
            for (int i = 0; i < m; ++i) {
                int u = in.nextInt() - (oneIndexed ? 1 : 0);
                int v = in.nextInt() - (oneIndexed ? 1 : 0);
                g[u].add(v);
            }
            return g;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

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

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

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

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

