#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
bool chmin(T &a, T b) {
  return (a > b) ? (a = b, 1) : 0;
}
using edge = struct { int to; };
using G = vector<vector<edge>>;
void add_edge(G &graph, int from, int to) { graph[from].push_back({to}); }
tuple<vector<int>, vector<int>, vector<int>, vector<int>> low_link(
    const G &graph) {
  int n = graph.size(), k = 0;
  vector<int> par(n), ord(n, -1), low(n), root(n, 0);
  function<void(int, int, int &)> dfs = [&](int v, int p, int &k) {
    ord[v] = k++, low[v] = ord[v], par[v] = p;
    for (auto &e : graph[v]) {
      if (e.to == p) continue;
      if (ord[e.to] == -1)
        dfs(e.to, v, k), chmin(low[v], low[e.to]);
      else
        chmin(low[v], ord[e.to]);
    }
  };
  for (int v = 0; v < n; ++v)
    if (ord[v] == -1) dfs(v, -1, k), root[v] = 1;
  return make_tuple(par, ord, low, root);
}
vector<tuple<int, int>> bridge(const G &graph) {
  const int n = graph.size();
  vector<int> par, ord, low, root;
  tie(par, ord, low, root) = low_link(graph);
  using state = tuple<int, int>;
  vector<state> res;
  for (int v = 0; v < n; ++v) {
    if (par[v] == -1) continue;
    if (ord[v] < low[par[v]] || ord[par[v]] < low[v]) {
      auto in = state(v, par[v]);
      if (get<1>(in) <= get<0>(in)) swap(get<0>(in), get<1>(in));
      res.push_back(in);
    }
  }
  return res;
}
bool cycle;
bool used[510];
void dfs(const G &graph, int v, int s) {
  used[v] = true;
  for (auto &e : graph[v]) {
    if (used[e.to]) {
      if (e.to == s) cycle = true;
    } else
      dfs(graph, e.to, s);
  }
}
int a[1010], b[1010];
int main(void) {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) cin >> a[i] >> b[i], a[i]--, b[i]--;
  bool ok = false;
  for (int bad = 0; bad < m; ++bad) {
    G graph(n), bgraph(n);
    for (int i = 0; i < m; ++i)
      if (i != bad)
        add_edge(graph, a[i], b[i]), add_edge(bgraph, a[i], b[i]),
            add_edge(bgraph, b[i], a[i]);
    auto target = bridge(bgraph);
    if (target.size() < 2) continue;
    cycle = false;
    for (int i = 0; i < n; ++i) {
      fill(used, used + n, false);
      dfs(graph, i, i);
    }
    if (cycle == false) ok = true;
  }
  if (ok)
    puts("YES");
  else
    puts("NO");
  return 0;
}
