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{
	static int[]v;
	static int notVisited=0,seen=1,visited=2;
	static int cycle=-1,tocyc;
	static int[]p;
	static boolean cyclic;
	static void dfs(int i) {
		v[i]=seen;
		for(int j:adj[i]) {
			if(v[j]==visited)continue;
			if(v[j]==notVisited) {
				p[j]=i;
				dfs(j);
			}
			else {
				cycle=i;
				tocyc=j;
			}
		}
		
		v[i]=visited;
	}
	static int[][]adj;
	static int x,y;
	static void dfs2(int i) {
		if(cyclic)return;
		v[i]=seen;
		for(int j:adj[i]) {
			if((i==x && j==y) || (i==y && j==x))continue;
			if(v[j]==visited)continue;
			if(v[j]==notVisited) {
				dfs2(j);
			}
			else {
				cyclic=true;
				return;
			}
		}
		
		v[i]=visited;
	}
	static void main() throws Exception{
		int n=sc.nextInt(),m=sc.nextInt();
		adj=new int[n][];
		p=new int[n];
		int[][]edges=new int[m][2];
		int[]sizes=new int[n];
		for(int i=0;i<m;i++) {
			int x=sc.nextInt()-1,y=sc.nextInt()-1;
			sizes[x]++;
			edges[i][0]=x;
			edges[i][1]=y;
		}
		for(int i=0;i<n;i++)adj[i]=new int[sizes[i]];
		for(int i=0;i<m;i++) {
			int x=edges[i][0],y=edges[i][1];
			adj[x][--sizes[x]]=y;
		}
		v=new int[n];
		for(int i=0;i<n;i++) {
			if(v[i]==notVisited) {
				p[i]=-1;
				dfs(i);
			}
		}
		if(cycle==-1) {
			pw.println("YES");
			return;
		}
		int cur=cycle;
		x=cur;
		y=tocyc;
		cyclic=false;
		for(int i=0;i<n;i++)v[i]=0;
		for(int i=0;i<n;i++) {
			if(v[i]==notVisited) {
				dfs2(i);
			}
		}
		if(!cyclic) {
			pw.println("YES");
			return;
		}
//		System.out.println(cur+" "+p[cur]+" "+tocyc);
		int cnt=0;
		while(cur!=tocyc && p[cur]!=-1) {
			x=cur;
			y=p[cur];
			cyclic=false;
			cur=p[cur];
			for(int i=0;i<n;i++)v[i]=0;
			for(int i=0;i<n;i++) {
				if(v[i]==notVisited) {
					dfs2(i);
				}
			}
			if(!cyclic) {
				pw.println("YES");
				return;
			}
			cnt++;
			if(cnt>n+7) {
				throw new Exception("???????? "+cnt+" "+cur+" "+p[cur]);
			}
		}
		pw.println("NO");
	}
	public static void main(String[] args) throws Exception{
		sc=new MScanner(System.in);
		pw = new PrintWriter(System.out);
		int tc=1;
//		tc=sc.nextInt();
		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
	 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
	 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
	 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
	 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
	 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
	 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	 
		public boolean ready() throws IOException {
			return br.ready();
		}
	 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
		
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}