Problem: You are given an acyclic directed graph, consisting of n vertices and m edges. The graph contains no multiple edges and no self-loops.

The vertex is called a source if it has no incoming edges. The vertex is called a sink if it has no outgoing edges. These definitions imply that some vertices can be both source and sink.

The number of sources in the given graph is equal to the number of sinks in it, and each of these numbers doesn't exceed 20.

The following algorithm is applied to the graph:

  1. if the graph has no sources and sinks then quit; 
  2. choose arbitrary source s, arbitrary sink t, add an edge from t to s to the graph and go to step 1 (that operation pops s out of sources and t out of sinks). Note that s and t may be the same vertex, then a self-loop is added. 



At the end you check if the graph becomes strongly connected (that is, any vertex is reachable from any other vertex).

Your task is to check that the graph becomes strongly connected no matter the choice of sources and sinks on the second step of the algorithm.

Input

The first line contains two integers n and m (1 ≤ n, m ≤ 10^6) — the number of vertices and the number of edges in the graph, respectively.

Each of the next m lines contains two integers v_i, u_i (1 ≤ v_i, u_i ≤ n, v_i ≠ u_i) — the description of the i-th edge of the original graph.

It is guaranteed that the number of sources and the number of sinks in the graph are the same and they don't exceed 20. It is guaranteed that the given graph contains no multiple edges. It is guaranteed that the graph contains no cycles.

Output

Print "YES" if the graph becomes strongly connected no matter the choice of sources and sinks on the second step of the algorithm. Otherwise print "NO".

Examples

Input

3 1
1 2


Output

NO


Input

3 3
1 2
1 3
2 3


Output

YES


Input

4 4
1 2
1 3
4 2
4 3


Output

YES

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool RD(T& v) {
  char c;
  bool n;
  while (c = getchar(), c != '-' && (c < '0' || c > '9'))
    if (c == EOF) return false;
  if (c == '-') {
    n = true;
    v = 0;
  } else {
    n = false;
    v = c - '0';
  }
  while (c = getchar(), c >= '0' && c <= '9') v = (v << 3) + (v << 1) + c - '0';
  if (n) v *= -1;
  return true;
}
template <typename A, typename... Args>
inline bool RD(A& a, Args&... rest) {
  return RD(a) && RD(rest...);
}
inline int RD() {
  int v;
  RD(v);
  return v;
}
inline char getchar_buffered() {
  static char _BUF_[1 << 15], *_HEAD_ = _BUF_, *_TAIL_ = _BUF_;
  return _HEAD_ == _TAIL_ &&
                 (_TAIL_ = (_HEAD_ = _BUF_) + fread(_BUF_, 1, 1 << 15, stdin),
                  _HEAD_ == _TAIL_)
             ? EOF
             : *_HEAD_++;
}
template <typename T>
inline bool RDB(T& v) {
  char c;
  bool n;
  while (c = getchar_buffered(), c != '-' && (c < '0' || c > '9'))
    if (c == EOF) return false;
  if (c == '-') {
    n = true;
    v = 0;
  } else {
    n = false;
    v = c - '0';
  }
  while (c = getchar_buffered() - '0', c >= 0 && c <= 9)
    v = (v << 3) + (v << 1) + c;
  if (n) v *= -1;
  return true;
}
template <typename A, typename... Args>
inline bool RDB(A& a, Args&... rest) {
  return RDB(a) && RDB(rest...);
}
inline int RDB() {
  int v;
  RDB(v);
  return v;
}
template <typename T>
inline void _WR(T a) {
  if (a < 0) {
    putchar('-');
    a *= -1;
  }
  T t = a / 10;
  if (t) _WR(t);
  putchar(a - (t << 1) - (t << 3) + '0');
}
template <typename T>
inline void WR_(const T& a) {
  _WR(a);
  putchar(' ');
}
template <typename T>
inline void WR(const T& a) {
  _WR(a);
  putchar('\n');
}
template <typename A, typename... Args>
inline void _WR(const A& a, const Args&... rest) {
  WR_(a);
  _WR(rest...);
}
template <typename A, typename... Args>
inline void WR_(const A& a, const Args&... rest) {
  WR_(a);
  WR_(rest...);
}
template <typename A, typename... Args>
inline void WR(const A& a, const Args&... rest) {
  WR_(a);
  WR(rest...);
}
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 10;
int n, m;
vector<int> eout[maxn], ein[maxn], es[maxn];
vector<int> sources, sinks;
void no() {
  puts("NO");
  exit(0);
}
void yes() {
  puts("YES");
  exit(0);
}
bool is_source(int i) { return ein[i].size() == 0; }
bool is_sink(int i) { return eout[i].size() == 0; }
void process_source(int s) {
  vector<bool> vis(n + 1, false);
  vis[s] = true;
  vector<int> to_sinks;
  vector<int> t = eout[s];
  while (t.size()) {
    int u = t.back();
    t.pop_back();
    if (vis[u]) continue;
    vis[u] = true;
    if (is_sink(u)) {
      to_sinks.push_back(u);
      continue;
    }
    t.insert(t.end(), eout[u].begin(), eout[u].end());
  }
  es[s].swap(to_sinks);
}
int cntbit(int x) {
  int ret = 0;
  while (x) {
    int lb = x & -x;
    x -= lb;
    ++ret;
  }
  return ret;
}
int cntbit2(int x) {
  x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1);
  x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2);
  x = (x & 0x0f0f0f0f) + ((x & 0xf0f0f0f0) >> 4);
  x = (x & 0x00ff00ff) + ((x & 0xff00ff00) >> 8);
  x = (x & 0x0000ffff) + ((x & 0xffff0000) >> 16);
  return x;
}
int main() {
  RDB(n, m);
  for (int i = 0; i < (int)(m); ++i) {
    int u, v;
    RDB(u, v);
    eout[u].push_back(v);
    ein[v].push_back(u);
  }
  for (int i = 1; i < (int)(n + 1); ++i) {
    if (is_source(i) && is_sink(i)) no();
    if (is_source(i)) sources.push_back(i);
    if (is_sink(i)) sinks.push_back(i);
  }
  if (sources.size() <= 1) yes();
  for (int s : sources)
    if (eout[s].size() <= 1) no();
  for (int s : sources) process_source(s);
  map<int, int> sink_to_idx;
  for (int i = 0; i < (int)(sinks.size()); ++i) sink_to_idx[sinks[i]] = i;
  vector<int> e_bm(sources.size(), 0);
  for (int i = 0; i < (int)(sources.size()); ++i) {
    for (int t : es[sources[i]]) {
      e_bm[i] |= 1 << sink_to_idx[t];
    }
  }
  for (int i = 1; i < (int)((1 << sources.size()) - 1); ++i) {
    int k = 0;
    for (int j = 0; j < (int)(sources.size()); ++j)
      if (i & 1 << j) k |= e_bm[j];
    if (cntbit2(k) <= cntbit2(i)) no();
  }
  yes();
  return 0;
}