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.*;
import java.util.*;


public class CF915D {

    private static final boolean TEST_CASES = false;

    private int enode = -1;
    private int snode = -1;

    private boolean commonEdge;

    void solve(int testCaseNo, InputReader in, PrintWriter out) {
        final int n = in.nextInt();
        final int m = in.nextInt();

        List<Integer>[] adj = new ArrayList[n];
        for (int i = 0; i < n; i++)
            adj[i] = new ArrayList<>();

        for (int i = 0; i < m; i++) {
            int u = in.nextInt() - 1;
            int v = in.nextInt() - 1;
            adj[u].add(v);
        }

        int[] col = new int[n];
        boolean[] isContainsCycle = new boolean[n];
        List<Integer> stack = new ArrayList<>();
        boolean atleastOneCycle = false;
        for (int i = 0; i < n; i++) {
            Arrays.fill(isContainsCycle, false);
            Arrays.fill(col, 0);
            enode = -1;
            snode = i;
            commonEdge = true;
            dfs(i, col, stack, adj, isContainsCycle);

            boolean flag = false;
            for (int j = 0; j < n; j++) {
                if (col[j] == 0)
                    if (dfs1(j, col, adj)) {
                        flag = true;
                        break;
                    }
            }

            if (isContainsCycle[i] && commonEdge && !flag) {
                out.println("YES");
                return;
            }
            atleastOneCycle |= isContainsCycle[i] | flag;
        }

        if (!atleastOneCycle)
            out.println("YES");
        else
            out.println("NO");
    }


    private boolean dfs1(int u, int[] col, List<Integer>[] adj) {
        col[u] = 1;
        boolean ret = false;
        for (int i = 0; i < adj[u].size(); i++) {
            int v = adj[u].get(i);

            if (col[v] == 1)
                ret = true;
            else if (col[v] == 0)
                ret |= dfs1(v, col, adj);
        }
        col[u] = 2;
        return ret;
    }

    private void dfs(int u, int[] col, List<Integer> stack, List<Integer>[] adj, boolean[] isContainsCycle) {
        col[u] = 1;
        stack.add(u);

        boolean cyclePresent = false;
        for (int i = 0; i < adj[u].size(); i++) {
            int v = adj[u].get(i);

            if (col[v] == 1) {
                cyclePresent = true;
                if ((v == snode) && (enode == stack.get(1) || enode == -1))
                    enode = stack.get(1);
                else commonEdge = false;
            } else if (col[v] == 0) {
                dfs(v, col, stack, adj, isContainsCycle);
                cyclePresent |= isContainsCycle[v];
            } else {
                cyclePresent |= isContainsCycle[v];
                if (isContainsCycle[v] && (stack.size() < 2 || enode != stack.get(1)))
                    commonEdge = false;
            }
        }
        stack.remove(stack.size() - 1);
        col[u] = 2;
        isContainsCycle[u] = cyclePresent;
    }


    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        /**
         * @return null if end of stream
         */
        public String readLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int testCases = TEST_CASES ? in.nextInt() : 1;

        CF915D solver = new CF915D();
        for (int testCase = 0; testCase < testCases; testCase++) {
            solver.solve(testCase, in, out);
        }
        out.flush();
        out.close();
    }
}