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

public class Solution {

    public static void solve(InputReader in, PrintWriter out, DebugWriter debug) throws IOException {
        int n = in.nextInt();
        int m = in.nextInt();

        Node[] graph = new Node[n];
        for (int i = 0; i < n; i++) {
            graph[i] = new Node(i);
        }

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

        int start = -1;
        for (int i = 0; i < n; i++) {
            int res = graph[i].findCircle();
            if (res != -1){
                start = res;
                break;
            }
        }

        if (start == -1){
            out.println("YES");
            return;
        }

        int pos = start;
        Node deleteLink = null;
        while (true){
            for(Node node : graph[pos].links){
                if (node.color == 1){
                    deleteLink = node;
                    break;
                }
            }

            graph[pos].links.remove(deleteLink);

            boolean find = false;
            for (int i = 0; i < n; i++) {
                if (graph[i].findCircle2()){
                    find = true;
                    break;
                }
            }

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

            for (int i = 0; i < n; i++) {
                graph[i].color2 = 0;
            }
            //graph[pos].recolor2();
            graph[pos].links.add(deleteLink);
            pos = deleteLink.id;

            if (pos == start) break;
        }

        out.println("NO");
    }

    public static class Node{

        public ArrayList<Node> links = new ArrayList<>();
        public int id;

        public int color = 0; //0 - не были, 1 - посетили, 2 - закончили
        public int color2 = 0; //0 - не были, 1 - посетили, 2 - закончили

        public Node(int id){
            this.id = id;
        }

        public int findCircle(){
            if (color == 2) return -1;
            if (color == 1){
                return id;
            }

            color = 1;
            for(Node node : links){
                int res = node.findCircle();
                if (res != -1) return res;
            }

            color = 2;
            return -1;
        }

        public boolean findCircle2(){
            if (color2 == 2) return false;
            if (color2 == 1){
                return true;
            }

            color2 = 1;
            for(Node node : links){
                if (node.findCircle2()) return true;
            }

            color2 = 2;
            return false;
        }

        public void recolor2(){
            if (color2 == 0) return;

            color2 = 0;
            for(Node node : links){
                node.recolor2();
            }
        }
    }

    public static final String NAME = "";

    public static void main(String[] args) throws IOException{
        InputReader in;
        PrintWriter out;
        DebugWriter debug;

        if (args.length > 0 && args[0].equals("file")) {
            in = new InputReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter(new FileWriter("output.txt"));
            debug = new DebugWriter(true);

            int sampleNumber = 1;
            do {
                String nextSample = "Sample #" + sampleNumber++ + ": ";
                out.println(nextSample);
                debug.println(nextSample);

                solve(in, out, debug);

                out.println("");
                debug.println("");
            } while (in.reader.readLine() != null);
        } else {
            if (NAME.length() > 0) {
                in = new InputReader(new BufferedReader(new FileReader(NAME + ".in")));
                out = new PrintWriter(new FileWriter(NAME + ".out"));
            } else {
                in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }

            debug = new DebugWriter(false);
            solve(in, out, debug);
        }

        in.reader.close();
        out.close();
    }

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

        public InputReader(BufferedReader reader) {
            this.reader = reader;
            tokenizer = null;
        }

        public String next() throws IOException{
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }

            return tokenizer.nextToken();
        }

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

        public int[] nextIntArray(int n) throws IOException{
            int[] array = new int[n];
            for (int i=0; i<n; i++){
                array[i] = nextInt();
            }

            return array;
        }
    }

    public static class DebugWriter {
        public boolean enable;

        public DebugWriter(boolean enable){
            this.enable = enable;
        }

        public void print(Object o){
            if (enable) System.out.print(o);
        }

        public void println(Object o){
            if (enable) System.out.println(o);
        }
    }

}