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;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << ": " << a << " ";
  err(++it, args...);
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vii = vector<pii>;
using vs = vector<string>;
const int DR[] = {-1, 0, 1, 0};
const int DC[] = {0, -1, 0, 1};
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = 1073741823;
const ll INFLL = 4e18;
const int MAX = 500;
int N, M;
vii adj[MAX + 5];
bool vis[MAX + 5], in_stack[MAX + 5];
stack<int> stk;
void read() {
  cin >> N >> M;
  for (int i = 0; i < (int)M; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back({v, i});
  }
}
bool dfs(int v) {
  vis[v] = in_stack[v] = true;
  bool flag = false;
  for (auto p : adj[v]) {
    int f = p.first;
    int id = p.second;
    if (!vis[f]) {
      stk.push(id);
      if (!dfs(f))
        stk.pop();
      else {
        flag = true;
        break;
      }
    } else if (in_stack[f]) {
      stk.push(id);
      flag = true;
      break;
    }
  }
  in_stack[v] = false;
  return flag;
}
bool check(int now, int edgeId) {
  vis[now] = in_stack[now] = true;
  bool flag = false;
  for (auto p : adj[now]) {
    int f = p.first;
    int id = p.second;
    if (id != edgeId) {
      if (!vis[f])
        flag |= check(f, edgeId);
      else if (in_stack[f])
        flag = true;
      if (flag) break;
    }
  }
  in_stack[now] = false;
  return flag;
}
void solve() {
  for (int v = (int)1; v <= (int)N; v++)
    if (!vis[v] && dfs(v)) {
      break;
    }
  if (stk.empty()) {
    cout << "YES\n";
    return;
  }
  while (!stk.empty()) {
    int now = stk.top();
    stk.pop();
    memset(vis, 0, sizeof vis);
    bool flag = true;
    for (int v = (int)1; v <= (int)N; v++)
      if (!vis[v] && check(v, now)) {
        flag = false;
        break;
      }
    if (flag) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TC = 1;
  while (TC--) {
    read();
    solve();
  }
}
