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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class D {
	public static BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
	public static StringTokenizer st;
	public static PrintWriter pw = new PrintWriter(System.out);
	final static boolean debugmode = true;
	public static int k = 7; // for 10^9 + k mods.
	public static long STMOD = 1000000000 + k; // 10^9 + k
	public static boolean[] dfsseen;
	//public static boolean twocyc;
	public static void main(String[] args) throws IOException{
		Node[] graph = new Node[getInt()];
		dfsseen = new boolean[graph.length];
		for(int i = 0;i<graph.length;i++){
			graph[i] = new Node();
		}
		int edj = getInt();
		for(int edge = 0;edge < edj;edge++){
			int start = getInt()-1;
			int end = getInt()-1;
			graph[start].addEdge(end);
		}
		LinkedList<Integer> progression = detectcycle(graph);
		//dfscycle(0,graph,new LinkedList<Integer>(),new HashSet<Integer>());
		if(progression == null){
			System.out.println("YES");
			return;
		}
		//System.out.println(progression);
		//progression.removeFirst();
		
		LinkedList<int[]> q = new LinkedList<int[]>(); 
		int prev = -1;
		for(int v : progression){
			q.add(new int[]{prev,v});
			prev = v;
		}
		for (int[] testable : q){
			if(testable[0] != -1){
				graph[testable[0]].disable(testable[1]);
				if(detectcycle(graph) == null){
					System.out.println("YES");
					return;
				}
				graph[testable[0]].reset();
			}
		}
		System.out.println("NO");
	}
	private static LinkedList<Integer> detectcycle(Node[] graph) {
		Arrays.fill(dfsseen,false);
		LinkedList<Integer> as = null;
		for(int i = 0;i<dfsseen.length;i++){
			if(!dfsseen[i]){
				LinkedList<Integer> answer = dfscycle(i,graph,new LinkedList<Integer>(),new HashSet<Integer>());
				if (answer != null){
					return answer;
				}
			}
		}
		return as;
	}
	private static LinkedList<Integer> dfscycle(int curr, Node[] graph, LinkedList<Integer> cpath,
			HashSet<Integer> seen) {
		//System.out.println("dfs on "+curr);
		dfsseen[curr] = true;
		//System.out.println("dfs on "+curr);
		cpath.add(curr);
		if(seen.contains(curr)){
			while(cpath.get(0) != curr){
				cpath.removeFirst();
			}
			return cpath;
		}
		seen.add(curr);
		for(int i  : graph[curr].children){
			if(graph[curr].disabled != i && (!dfsseen[i] || seen.contains(i))){
				LinkedList<Integer> ans =dfscycle(i,graph,cpath,seen);
				if(ans != null){
					return ans;
				}
			}
		}
		seen.remove(curr);
		cpath.removeLast();
		return null;
	}
	public int GCD(int a, int b) {
		   if (b==0) return a;
		   return GCD(b,a%b);
	}
	public double log(int k, int v){
		return Math.log(k)/Math.log(v);
	}
	/*
	public long intpower(int a,int b,long curr,long exp){
		if(b == exp){
			return b * b;
		}
		else if(2*b < exp){
			return intpower(a,,)
		}
	}
	*/
	public static void debug(String toPrint){
		if(!debugmode) {return;}
		pw.println("[DEBUG]: "+toPrint);
	}
	public static void  submit(int[] k){
		pw.println(Arrays.toString(k));
		pw.close();
	}
	public static void submit(int p){
		pw.println(Integer.toString(p));
		pw.close();
	}
	public static void submit(String k){
		pw.println(k);
		pw.close();
	}
	public static void submit(double u){
		pw.println(Double.toString(u));
		pw.close();
	}
	public static void submit(long lng){
		pw.println(Long.toString(lng));
		pw.close();
		
	}
	public static int getInt() throws IOException{
		if (st != null && st.hasMoreTokens()){
			return Integer.parseInt(st.nextToken());
		}
		st = new StringTokenizer(sc.readLine());
		return Integer.parseInt(st.nextToken());
	}
	public static long getLong() throws IOException{
		if (st != null && st.hasMoreTokens()){
			return Long.parseLong(st.nextToken());
		}
		st = new StringTokenizer(sc.readLine());
		return Long.parseLong(st.nextToken());
	}
	public static double getDouble()throws IOException{
		if (st != null && st.hasMoreTokens()){
			return Double.parseDouble(st.nextToken());
		}
		st = new StringTokenizer(sc.readLine());
		return Double.parseDouble(st.nextToken());
	}
	public static String getString()throws IOException{
		if(st != null && st.hasMoreTokens()){
			return st.nextToken();
		}
		st = new StringTokenizer(sc.readLine());
		return st.nextToken();
	}
	public static String getLine() throws IOException{
		return sc.readLine();
	}
	public static int[][] readMatrix(int lines,int cols) throws IOException{
		int[][] matrr = new int[lines][cols];
		for (int i = 0;i < lines;i++){
			for(int j = 0;j < cols;j++){
				matrr[i][j] = getInt();
			}
		}
		return matrr;
	}
	public static int[] readArray(int lines) throws IOException{
		int[] ar = new int[lines];		
		for (int i = 0;i<lines;i++) ar[i] =getInt();
		return ar;
	}
	
}
class Node{
	public LinkedList<Integer> children;
	public int disabled = -1;
	public Node(){children = new LinkedList<Integer>();}
	public void addEdge(int v){
		children.add(v);
	}
	public void disable(int v){
		disabled = v;
	}
	public void reset(){
		disabled = -1;
	}
}