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 __TESTCASE = 0;
template <class _T>
inline void ina(_T a[], int n) {
  int i;
  for (i = 0; i < n; i++) cin >> a[i];
}
template <class _T>
inline void outa(_T a[], int n) {
  int i;
  for (i = 0; i < n - 1; i++) cout << a[i], cout << " ";
  if (i) printf("%d", i);
  cout << "\n";
}
const double EPS = 1e-9;
const int SIZE = 1e6;
template <class _T>
inline _T pow(_T a, _T b, _T m) {
  a %= m;
  _T ans = 1 % m;
  while (b) {
    if (b & 1) ans *= a, ans %= m;
    a *= a;
    a %= m;
    b >>= 1;
  }
  return ans;
}
template <class _T>
inline _T pow(_T a, _T b) {
  _T ans = 1;
  while (b) {
    if (b & 1) ans *= a;
    a *= a;
    b >>= 1;
  }
  return ans;
}
template <class _T>
inline _T add(_T a, _T b, _T m) {
  return a >= m - b ? a - (m - b) : a + b;
}
template <class _T>
inline _T multiply(_T a, _T b, _T m) {
  _T ans = 0;
  if (b > a) swap(a, b);
  while (b) {
    if (b & 1) ans = add(ans, a, m);
    b >>= 1;
    a = add(a, a, m);
  }
  return ans;
}
template <class _T>
inline _T bigpow(_T a, _T b, _T m) {
  a %= m;
  _T ans = 1 % m;
  while (b) {
    if (b & 1) ans = multiply(ans, a, m);
    a = multiply(a, a, m);
    b >>= 1;
  }
  return ans;
}
template <class _T>
inline _T modinvers(_T a, _T m) {
  return m > 2000000000LL ? bigpow(a, m - 2, m) : pow(a, m - 2, m);
}
template <class _T>
_T _egcd(_T a, _T b, _T &x, _T &y) {
  if (!b) {
    x = 1, y = 0;
    return a;
  }
  _T _g = _egcd(b, a % b, x, y);
  _T xt = x;
  x = y, y = xt - (a / b) * y;
  return _g;
}
template <class _T>
inline _T fmodinvers(_T a, _T m) {
  _T x, y;
  _egcd(a, m, x, y);
  x %= m;
  if (x < 0) x += m;
  return x;
}
template <class _T>
inline _T _lcm(_T a, _T b) {
  return (a * b) / __gcd(a, b);
}
template <class _T>
inline _T naturalSum(_T n) {
  return (n * (n + 1)) / 2;
}
template <class _T>
inline _T sqrSum(_T n) {
  return (n * (n + 1) * (2 * n + 1)) / 6;
}
template <class _T>
inline _T cubeSum(_T n) {
  return (((n * (n + 1)) / 2) * ((n * (n + 1)) / 2));
}
template <class _T>
inline _T naturalSum(_T n, _T m) {
  return ((n * (n + 1)) / 2) % m;
}
long long MOD_INV_OF_6;
template <class _T>
inline _T sqrSum(_T n, _T m) {
  n %= m;
  return (((((n * (n + 1)) % m) * (((2 * n) % m + 1) % m)) % m) *
          MOD_INV_OF_6) %
         m;
}
template <class _T>
inline _T cubeSum(_T n, _T m) {
  return ((((n * (n + 1)) / 2) % m) * (((n * (n + 1)) / 2) % m)) % m;
}
vector<int> adj[505];
pair<int, int> del;
bool vis[505], run[505];
bool cycle;
void dfs(int u) {
  vis[u] = run[u] = 1;
  for (int v : adj[u]) {
    if (del == make_pair(u, v)) continue;
    if (run[v]) {
      cycle = 1;
      return;
    }
    if (!vis[v]) dfs(v);
    if (cycle) return;
  }
  run[u] = 0;
}
int n;
bool chk() {
  memset(vis, 0, (n + 2) * (sizeof(vis[0])));
  memset(run, 0, (n + 2) * (sizeof(run[0])));
  int i;
  cycle = 0;
  for (i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i);
      if (cycle) return 0;
    }
  }
  return 1;
}
vector<int> path;
int cs;
void dfs1(int u) {
  path.push_back(u);
  vis[u] = run[u] = 1;
  for (int v : adj[u]) {
    if (run[v]) {
      path.push_back(v);
      cs = v;
      cycle = 1;
      return;
    }
    if (!vis[v]) dfs1(v);
    if (cycle) return;
  }
  path.pop_back();
  run[u] = 0;
}
int main() {
  int m, i, u, v;
  ;
  scanf("%d %d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
  }
  for (i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs1(i);
      if (cycle) break;
    }
  }
  if (!cycle) {
    printf("YES\n");
    return 0;
  }
  i = 0;
  while (path[i] != cs) i++;
  i++;
  for (; i < ((int)(path).size()); i++) {
    del = {path[i - 1], path[i]};
    if (chk()) {
      printf("YES\n");
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
