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.*;

import static java.lang.Math.min;
import static java.lang.Math.nextAfter;

public class Main {

    StringTokenizer in;
    BufferedReader br;
    PrintWriter pw;

    int n;
    int m;
    int[][] g;
    int next[];

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

    boolean found = false;
    int used[][];

    public void solve() throws IOException {
        n = nextInt();
        g = new int[n][n];
        next = new int[n];
        Arrays.fill(next, -1);
        m = nextInt();
        used = new int[2][n];
        for (int i = 0; i < m; i++) {
            g[nextInt() - 1][nextInt() - 1] = 1;
        }
        int c = 0;
        for (int i = 0; i < n; i++) {
            if (used[0][i] == 0) {
                if (find(i, 0)) {
                    c++;
                    if (c == 2) {
                        pw.print("NO");
                        return;
                    }
                    for (int j = 0; j < n; j++) {
                        boolean ans = false;
                        if (next[j] != -1) {
                            Arrays.fill(used[1], 0);
                            g[j][next[j]] = 0;
                            for (int k = 0; k < n; k++) {
                                if (used[1][k] == 0) {
                                    ans |= find(k, 1);
                                }
                            }
                            g[j][next[j]] = 1;
                            if (!ans) {
                                pw.print("YES");
                                return;
                            }
                        }
                    }
                    pw.print("NO");
                    return;
                }
            }
        }
        pw.print("YES");
    }

    boolean find(int v, int j) {
        if (used[j][v] == 2) return false;
        if (used[j][v] == 1) return true;
        used[j][v] = 1;
        for (int i = 0; i < n; i++) {
            if (g[v][i] == 1) {
                int to = i;
                if (find(to, j)) {
                    if (j == 0) next[v] = to;
                    return true;
                }
            }
        }
        used[j][v] = 2;
        return false;
    }


    public void run() {
        try {
//            br = new BufferedReader(new FileReader("input.txt"));
//            pw = new PrintWriter(new FileWriter("output.txt"));
//            br = new BufferedReader(new FileReader("b2.txt"));
//            pw = new PrintWriter(new FileWriter("output.txt"));
            br = new BufferedReader(new InputStreamReader(System.in));
            pw = new PrintWriter(new OutputStreamWriter(System.out));

            solve();

            pw.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }


}