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 Main {

    public static void main(String[] args) throws IOException {

        new Main().go();
    }

    PrintWriter out;
    Reader in;
    BufferedReader br;

    Main() throws IOException {

        try {

            //br = new BufferedReader( new FileReader("input.txt") );
            in = new Reader("input.txt");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            //br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }
    }

    void go() throws IOException {

        int t = 1;
        while (t > 0) {
            solve();
            //out.println();
            t--;
        }

        out.flush();
        out.close();
    }

    int inf = 2000000000;
    int mod = 1000000007;
    double eps = 0.000000001;

    int n;
    int m;

    ArrayList<Integer>[] g = new ArrayList[1000];

    void solve() throws IOException {

        int n = in.nextInt();
        int m = in.nextInt();

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

        for (int i = 0; i < m; i++) {
            int x = in.nextInt()-1;
            int y = in.nextInt()-1;
            g[x].add(y);
        }

        for (int i = 0; i < n; i++) {
            if (col[i] == 0) {
                dfs(i, 0);
            }
        }

        if (cyc == -1) {
            out.println("YES");
        }
        else {

            int cur = cyc;
            int end = cyc;
            boolean ok = false;

            while (!ok && cur != start) {

                Arrays.fill(col, 0);
                du = cur;
                dv = p[cur];
                cyc = -1;
                for (int i = 0; i < n; i++)
                    if (col[i] == 0)
                        dfs2(i);
                cur = p[cur];
                if (cyc == -1) ok = true;
            }

            if (!ok) {
                Arrays.fill(col, 0);
                du = start;
                dv = end;
                cyc = -1;
                for (int i = 0; i < n; i++)
                    if (col[i] == 0)
                        dfs2(i);
                if (cyc == -1) ok = true;
            }

            out.println(ok ? "YES" : "NO");
        }

    }

    int len = inf;
    int cyc = -1;
    int start = -1;
    int[] col = new int[500];
    int[] p = new int[500];
    int[] d = new int[500];

    int dv = -1;
    int du = -1;

    void dfs(int v, int h) {

        col[v] = 1;

        for (int u : g[v]) {

            if (col[u] == 0) {
                p[u] = v;
                d[u] = d[v] + 1;
                dfs(u, h+1);
            }
            else
            if (col[u] == 1) {
                if (d[v] - d[u] < len) {
                    len = d[v] - d[u];
                    cyc = v;
                    start = u;
                }
            }
        }

        col[v] = 2;
    }

    void dfs2(int v) {

        col[v] = 1;

        for (int u : g[v]) {

            if (dv == v && du == u)
                continue;

            if (col[u] == 0) {
                dfs2(u);
            }
            else
            if (col[u] == 1) {
                cyc = v;
            }
        }

        col[v] = 2;
    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {

            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {

            if (a > p.a) return 1;
            if (a < p.a) return -1;
            if (b > p.b) return 1;
            if (b < p.b) return -1;
            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }


        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}