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.
#include <bits/stdc++.h>
using namespace std;
int state[501], n;
vector<int> nei[501], loop;
bool find_loop(int x) {
  if (state[x] == 1) return false;
  loop.push_back(x);
  if (state[x] == 2) {
    reverse((loop).begin(), (loop).end());
    while (loop[loop.size() - 1] != loop[0]) loop.pop_back();
    reverse((loop).begin(), (loop).end());
    return true;
  }
  state[x] = 2;
  for (int i = 0; i < nei[x].size(); i++) {
    int to = nei[x][i];
    if (find_loop(to)) return true;
  }
  loop.pop_back();
  state[x] = 1;
  return false;
}
pair<int, int> taboo;
bool no_loop(int x) {
  if (state[x]) return state[x] == 1;
  state[x] = 2;
  for (int i = 0; i < nei[x].size(); i++) {
    int to = nei[x][i];
    if (make_pair(x, to) == taboo) continue;
    if (!no_loop(to)) return false;
  }
  state[x] = 1;
  return true;
}
bool ok() {
  fill(state + 1, state + n + 1, 0);
  for (int i = 1; i <= n; i++) {
    if (state[i]) continue;
    if (!no_loop(i)) {
      return false;
    }
  }
  return true;
}
int main() {
  int m, i;
  scanf("%d%d", &n, &m);
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    nei[x].push_back(y);
  }
  for (i = 1; i <= n; i++) {
    if (state[i]) continue;
    if (find_loop(i)) break;
  }
  if (loop.empty()) return !printf("YES");
  for (i = 0; i < loop.size() - 1; i++) {
    taboo = make_pair(loop[i], loop[i + 1]);
    if (ok()) return !printf("YES");
  }
  printf("NO");
  return 0;
}
