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


import java.io.*;
/*
-> Written by <-
  -----------
 |J_O_B_E_E_L|
 |___________|
 |    ___    |
 |   (^_^)   |
 |  /( | )\  |
 |____|_|____|
*/


public class Main {
	static int [] primes;
	static int [] color,parent;
	static int c,p;
	static ArrayList<Integer>[]lists;
	static int cycle_start, cycle_end;
	static boolean dfs(int u) {
		color[u]=1;
		for(int v:lists[u]) {
			if(color[v]==1) {
				cycle_start=v;
				cycle_end=u;
				return true;
			}
			else if(color[v]==0) {
				parent[v]=u;
				if (dfs(v)) return true;
			}
		}
		color[u]=2;
		return false;
	}
	
	public static void main(String[] args) throws Exception {
		int n=sc.nextInt(),m=sc.nextInt();
		color=new int [n];
		parent=new int [n];
		Arrays.fill(parent, -1);
		lists=new ArrayList[n];
		for(int i=0;i<n;i++) lists[i]=new ArrayList<>();
		while(m-->0) {
			int u=sc.nextInt()-1; int v=sc.nextInt()-1;
			lists[u].add(v);
		}
		cycle_start = -1;
		for(int i=0;i<n;i++) {
			if(color[i]==0 && dfs(i)) break;
		}
		ArrayList<Integer> list=new ArrayList<>();
		if(cycle_start==-1) pw.println("Yes");
		else {
			list.add(cycle_start);
			for(int v=cycle_end;v!=cycle_start;v=parent[v]) list.add(v);
			list.add(cycle_start);
		    boolean f=false;
		  //  pw.println(list);
			for(int i=list.size()-1;i>0;i--) {
				f=false;
		    	color=new int [n];
		    	int p=list.get(i); int c=list.get(i-1);
		    	lists[p].remove((Integer)c);
		    	for(int j=0;j<n;j++) {
		    		if(color[j]==0) f|=dfs(j);
		    	}
//		    	pw.println(list);
//		    	pw.println(f);
		    	if(!f) break;
		    	
		    	lists[p].add(c);
		    }
			pw.println(f?"NO":"YES");
		}
		pw.flush();
		pw.close();
	}
	static class pair{
		int u; int v;
		public pair(int u,int v) {this.u=u; this.v=v;}
		public String toString() {return u+" "+v;}
	}
	// log(n)
	static long pow(long a, int n){
		long res = 1;
		while(n != 0)
		{
			if((n & 1) == 1)
				res *= a;
			a *= a;
			n >>= 1;			
		}
		return res;
	}
	
	// O(log n)
	static int gcd(int a,int b) {
		if(b==0) return a;
		return gcd(b, a%b);
	}
	
	static int LCM(int a,int b) {
		return (a*b)/gcd(a, b);
	}
	
	// The following function calculates the value of pow(x,n) mod m:
	// O(log n)
	
	static long  modpow(int x,int n,int m) {
		if(n==0) return 1%m;
		long u=modpow(x, n/2, m);
		u=(u*u)%m;
		if(n%2==1) u=(u*x)%m;
		return u;
	}
    static class Scanner {
    	 
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int curbuf;
        private int lenbuf;
 
        public Scanner(InputStream in) {
            this.in = in;
            this.curbuf = this.lenbuf = 0;
        }
 
        public boolean hasNextByte() {
            if (curbuf >= lenbuf) {
                curbuf = 0;
                try {
                    lenbuf = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0)
                    return false;
            }
            return true;
        }
 
        private int readByte() {
            if (hasNextByte())
                return buffer[curbuf++];
            else
                return -1;
        }
 
        private boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }
 
        private void skip() {
            while (hasNextByte() && isSpaceChar(buffer[curbuf]))
                curbuf++;
        }
 
        public boolean hasNext() {
            skip();
            return hasNextByte();
        }
 
        public String next() {
            if (!hasNext())
                throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (!isSpaceChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
 
        public int nextInt() {
            if (!hasNext())
                throw new NoSuchElementException();
            int c = readByte();
            while (isSpaceChar(c))
                c = readByte();
            boolean minus = false;
            if (c == '-') {
                minus = true;
                c = readByte();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res = res * 10 + c - '0';
                c = readByte();
            } while (!isSpaceChar(c));
            return (minus) ? -res : res;
        }
 
        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            int c = readByte();
            while (isSpaceChar(c))
                c = readByte();
            boolean minus = false;
            if (c == '-') {
                minus = true;
                c = readByte();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res = res * 10 + c - '0';
                c = readByte();
            } while (!isSpaceChar(c));
            return (minus) ? -res : res;
        }
 
        public double nextDouble() {
            return Double.parseDouble(next());
        }
 
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
 
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
 
    }
	static Scanner sc = new Scanner(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
}
