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.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.Stack;
import java.util.ArrayList;
import java.io.InputStream;

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

    static class DAlmostAcyclicGraph {
        ArrayList<Integer>[] g;
        Stack<int[]> edges;
        boolean[] visited;
        boolean[] stack;
        ArrayList<int[]> check;
        int n;
        boolean[][] graph;

        void dfs(int node) {
            visited[node] = true;
            stack[node] = true;
            for (int k : g[node]) {
                if (!visited[k]) {
                    edges.push(new int[]{node, k});
                    dfs(k);
                    edges.pop();
                } else {
                    if (stack[k]) {
                        edges.push(new int[]{node, k});
                        check = new ArrayList<>();
                        for (int p[] : edges) check.add(new int[]{p[0], p[1]});
                        edges.pop();
                    }
                }
            }
            stack[node] = false;
        }

        boolean cycle(int node) {
            visited[node] = true;
            stack[node] = true;
            for (int k = 1; k <= n; k++) {
                if (!graph[node][k]) continue;
                if (!visited[k]) {
                    if (cycle(k)) return true;
                } else {
                    if (stack[k]) return true;
                }
            }
            stack[node] = false;
            return false;
        }

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            n = in.scanInt();
            int m = in.scanInt();
            graph = new boolean[n + 1][n + 1];
            g = new ArrayList[n + 1];
            for (int i = 0; i <= n; i++) g[i] = new ArrayList<>();
            visited = new boolean[n + 1];
            stack = new boolean[n + 1];
            edges = new Stack<>();
            for (int i = 0; i < m; i++) {
                int a = in.scanInt();
                int b = in.scanInt();
                graph[a][b] = true;
                g[a].add(b);
            }

            for (int i = 1; i <= n; i++) {
                if (!visited[i]) dfs(i);
            }

            if (check == null) {
                out.println("YES");
                return;
            }

            for (int a[] : check) {
                graph[a[0]][a[1]] = false;
                visited = new boolean[n + 1];
                stack = new boolean[n + 1];

                boolean flag = false;
                for (int i = 1; i <= n; i++) {
                    if (!visited[i]) flag |= cycle(i);
                }

                if (!flag) {
                    out.println("YES");
                    return;
                }


                graph[a[0]][a[1]] = true;
            }

            out.println("NO");

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}

