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>
int dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};
using namespace std;
long long power(long long a, long long p, long long M) {
  long long r = 1;
  a = a % M;
  while (p > 0) {
    if (p % 2) r = (r * a) % M;
    a = (a * a) % M;
    p /= 2;
  }
  return r;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long n, m;
set<long long> e[100005];
stack<long long> cycle, temp;
long long vis[505];
bool found;
void findCycle(long long x) {
  temp.push(x);
  vis[x] = 1;
  for (auto y : e[x]) {
    if (vis[y] == 0)
      findCycle(y);
    else if (vis[y] == 1) {
      if (found) return;
      cycle = temp;
      cycle.push(y);
      found = 1;
      return;
    }
  }
  if (!temp.empty()) temp.pop();
  vis[x] = 2;
}
void fc(long long x) {
  vis[x] = 1;
  for (auto y : e[x]) {
    if (vis[y] == 0)
      fc(y);
    else if (vis[y] == 1) {
      found = 1;
      return;
    }
  }
  vis[x] = 2;
}
void solve() {
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    e[a].insert(b);
  }
  for (long long i = 1; i < n + 1; i++) {
    if (!vis[i]) {
      findCycle(i);
      if (found) break;
    }
  }
  if (!found) {
    cout << "YES\n";
    return;
  }
  vector<long long> c;
  for (long long i = 0; i < 505; i++) vis[i] = 0;
  while (!cycle.empty()) {
    c.push_back(cycle.top());
    if (vis[cycle.top()]) {
      break;
    }
    vis[cycle.top()] = 1;
    cycle.pop();
  }
  reverse(c.begin(), c.end());
  for (long long i = 0; i < c.size() - 1; i++) {
    found = 0;
    e[c[i]].erase(c[i + 1]);
    for (long long j = 0; j < 505; j++) vis[j] = 0;
    for (long long j = 1; j < n + 1; j++) {
      if (!vis[j]) fc(j);
      if (found) {
        break;
      }
    }
    if (!found) {
      cout << "YES\n";
      return;
    }
    e[c[i]].insert(c[i + 1]);
  }
  cout << "NO\n";
}
int main() {
  solve();
  return 0;
}
