#include <bits/stdc++.h>
using namespace std;
struct edge {
  int from, to, id;
};
int N, M;
int a[30000], b[30000];
vector<edge> G[500];
bool visited[500];
int depth[500];
int cnt[500];
vector<edge> bridges;
void dfs(int pos, int prev) {
  visited[pos] = true;
  for (int i = 0; i < (int)G[pos].size(); i++) {
    int to = G[pos][i].to;
    if (to == prev) continue;
    if (!visited[to]) {
      depth[to] = depth[pos] + 1;
      dfs(to, pos);
      cnt[pos] += cnt[to];
      if (cnt[to] == 0) bridges.push_back(G[pos][i]);
    } else if (depth[to] < depth[pos]) {
      cnt[pos]++;
      cnt[to]--;
    }
  }
}
int countB(int id) {
  bridges.clear();
  memset(visited, false, sizeof(visited));
  memset(depth, 0, sizeof(depth));
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < N; i++) G[i].clear();
  for (int i = 0; i < M; i++) {
    if (i == id) continue;
    G[a[i]].push_back((edge){a[i], b[i], i});
    G[b[i]].push_back((edge){b[i], a[i], i});
  }
  dfs(0, -1);
  return bridges.size();
}
bool check(int id) {
  int B = countB(id);
  if (B < 2) return false;
  queue<int> Q;
  vector<int> C(N, 0);
  for (int i = 0; i < M; i++)
    if (id != i) C[b[i]]++;
  for (int i = 0; i < N; i++)
    if (C[i] == 0) Q.push(i);
  int cc = 0;
  while (!Q.empty()) {
    int pos = Q.front();
    Q.pop();
    cc++;
    for (int i = 0; i < (int)G[pos].size(); i++) {
      int to = G[pos][i].to;
      C[to]--;
      if (C[to] == 0) Q.push(to);
    }
  }
  if (cc == N)
    return true;
  else
    return false;
}
vector<edge> loope;
bool rec(int pos, int si, int pre = -1) {
  if (visited[pos]) return (pos == si);
  visited[pos] = true;
  for (int i = 0; i < (int)G[pos].size(); i++) {
    edge e = G[pos][i];
    if (e.id == pre) continue;
    if (rec(e.to, si, e.id)) {
      loope.push_back(e);
      return true;
    }
  }
  return false;
}
bool solve2() {
  for (int i = 0; i < N; i++) {
    memset(visited, false, sizeof(visited));
    memset(depth, 0, sizeof(depth));
    loope.clear();
    if (rec(i, i)) {
      break;
    }
  }
  for (int i = 0; i < (int)loope.size(); i++) {
    if (check(loope[i].id)) return true;
  }
  return false;
}
bool solve() {
  for (int i = 0; i < N; i++) G[i].clear();
  for (int i = 0; i < M; i++) G[a[i]].push_back((edge){a[i], b[i], i});
  if (solve2()) return true;
  for (int i = 0; i < N; i++) G[i].clear();
  for (int i = 0; i < M; i++) G[a[i]].push_back((edge){a[i], b[i], i});
  for (int i = 0; i < M; i++) G[b[i]].push_back((edge){b[i], a[i], i});
  if (solve2()) return true;
  return false;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  cout << (solve() ? "YES" : "NO") << endl;
  return 0;
}
