#include <bits/stdc++.h>
using namespace std;
int n, m, Z;
int a[1005], b[1005];
bool isB[505][505];
bool visited[505];
vector<int> G[505];
int cnt[505];
int depth[505];
vector<pair<int, int> > B, SB;
void initG() {
  for (int i = 0; i < 505; i++) G[i].clear();
}
void Dfs(int pos, int prev) {
  visited[pos] = true;
  for (int i = 0; i < (int)G[pos].size(); i++) {
    int to = G[pos][i];
    if (to == prev) continue;
    Z++;
    if (!visited[to]) {
      Z--;
      depth[to] = depth[pos] + 1;
      Dfs(to, pos);
      cnt[pos] += cnt[to];
      if (cnt[to] == 0) B.push_back(pair<int, int>(min(pos, to), max(pos, to)));
    } else if (depth[to] < depth[pos]) {
      cnt[pos]++;
      cnt[to]--;
    }
  }
}
void calcB(int id = -1) {
  Z = 0;
  initG();
  for (int i = 0; i < m; i++) {
    if (id == i) continue;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  memset(visited, false, sizeof(visited));
  memset(cnt, 0, sizeof(cnt));
  memset(depth, 0, sizeof(depth));
  B.clear();
  Dfs(0, -1);
  for (int i = 0; i < (int)B.size(); i++) {
    int fi = B[i].first;
    int se = B[i].second;
    isB[fi][se] = isB[se][fi] = true;
  }
}
bool isDag() {
  int C[505] = {};
  queue<int> Q;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < (int)G[i].size(); j++) {
      int to = G[i][j];
      C[to]++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (C[i] == 0) Q.push(i);
  }
  int count = 0;
  while (!Q.empty()) {
    int pos = Q.front();
    Q.pop();
    count++;
    for (int i = 0; i < (int)G[pos].size(); i++) {
      int to = G[pos][i];
      C[to]--;
      if (C[to] == 0) Q.push(to);
    }
  }
  return (count == n);
}
bool solve(int id) {
  if (isB[a[id]][b[id]]) return false;
  initG();
  for (int i = 0; i < m; i++) {
    if (i == id) continue;
    G[a[i]].push_back(b[i]);
  }
  if (!isDag()) return false;
  calcB(id);
  if ((int)B.size() >= 2)
    return true;
  else
    return false;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
  }
  calcB();
  bool flag = false;
  for (int i = 0; i < n; i++) {
    if (cnt[i] == Z) flag = true;
  }
  if (flag && B.size() >= 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
  for (int i = 0; i < m; i++) {
    if (solve(i)) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
