#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int src, dst;
  int weight;
  Edge(int src, int dst, int weight = 1) : src(src), dst(dst), weight(weight) {}
};
bool operator<(const Edge& e, const Edge& f) {
  return e.weight != f.weight ? e.weight > f.weight
         : e.src != f.src     ? e.src < f.src
                              : e.dst < f.dst;
}
void visit(const vector<vector<Edge> >& g, int v, int u, vector<Edge>& brdg,
           vector<vector<int> >& tecomp, stack<int>& roots, stack<int>& S,
           vector<bool>& inS, vector<int>& num, int& time) {
  num[v] = ++time;
  S.push(v);
  inS[v] = true;
  roots.push(v);
  for (__typeof((g[v]).begin()) e = (g[v]).begin(); e != (g[v]).end(); ++e) {
    int w = e->dst;
    if (num[w] == 0)
      visit(g, w, v, brdg, tecomp, roots, S, inS, num, time);
    else if (u != w && inS[w])
      while (num[roots.top()] > num[w]) roots.pop();
  }
  if (v == roots.top()) {
    brdg.push_back(Edge(u, v));
    tecomp.push_back(vector<int>());
    while (1) {
      int w = S.top();
      S.pop();
      inS[w] = false;
      tecomp.back().push_back(w);
      if (v == w) break;
    }
    roots.pop();
  }
}
void bridge(const vector<vector<Edge> >& g, vector<Edge>& brdg,
            vector<vector<int> >& tecomp) {
  const int n = g.size();
  vector<int> num(n);
  vector<bool> inS(n);
  stack<int> roots, S;
  int time = 0;
  for (int u = 0; u < (int)n; ++u)
    if (num[u] == 0) {
      visit(g, u, n, brdg, tecomp, roots, S, inS, num, time);
      brdg.pop_back();
    }
}
int INF = 1e5;
int minimumCut(const vector<vector<Edge> >& g) {
  int n = g.size();
  vector<vector<int> > h(n, vector<int>(n));
  for (int u = 0; u < (int)n; ++u)
    for (__typeof((g[u]).begin()) e = (g[u]).begin(); e != (g[u]).end(); ++e)
      h[e->src][e->dst] += e->weight;
  vector<int> V(n);
  for (int u = 0; u < (int)n; ++u) V[u] = u;
  int cut = INF;
  for (int m = n; m > 1; m--) {
    vector<int> ws(m, 0);
    int u, v;
    int w;
    for (int k = 0; k < (int)m; ++k) {
      u = v;
      v = max_element(ws.begin(), ws.end()) - ws.begin();
      w = ws[v];
      ws[v] = -1;
      for (int i = 0; i < (int)m; ++i)
        if (ws[i] >= 0) ws[i] += h[V[v]][V[i]];
    }
    for (int i = 0; i < (int)m; ++i) {
      h[V[i]][V[u]] += h[V[i]][V[v]];
      h[V[u]][V[i]] += h[V[v]][V[i]];
    }
    V.erase(V.begin() + v);
    cut = min(cut, w);
  }
  return cut;
}
int deg[555] = {};
int main() {
  int n, m;
  cin >> n >> m;
  if (m == n - 1) {
    cout << "NO" << endl;
    return 0;
  }
  vector<vector<Edge> > g(n);
  vector<Edge> input_edges;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    deg[a]++;
    deg[b]++;
    g[a].push_back(Edge(a, b));
    g[b].push_back(Edge(b, a));
    input_edges.push_back(Edge(a, b));
  }
  int is_ok = 0;
  for (int i = 0; i < n; i++) {
    if (deg[i] != 2) continue;
    vector<int> d;
    for (auto e : g[i]) {
      d.push_back(deg[e.dst]);
    }
    sort(d.begin(), d.end());
    if (d.size() >= 2 and d[0] == 2 and d[1] == 2) {
      is_ok = 1;
    }
  }
  vector<vector<int> > tecomp;
  vector<Edge> es;
  bridge(g, es, tecomp);
  if (es.size() == 0) {
    if (is_ok) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    return 0;
  }
  if (es.size() > 1) {
    cout << "YES" << endl;
    return 0;
  }
  Edge brdg = es[0];
  if (brdg.src > brdg.dst) swap(brdg.src, brdg.dst);
  for (auto s : tecomp) {
    map<int, int> idx;
    for (auto i : s) {
      int k = idx.size();
      idx[i] = k;
    }
    vector<vector<Edge> > gg(idx.size());
    for (auto e : input_edges) {
      if (e.src > e.dst) swap(e.src, e.dst);
      if (e.src == brdg.src and e.dst == brdg.dst) {
        continue;
      }
      if (!idx.count(e.src)) continue;
      gg[idx[e.src]].push_back(Edge(idx[e.src], idx[e.dst]));
      gg[idx[e.dst]].push_back(Edge(idx[e.dst], idx[e.src]));
    }
    if (minimumCut(gg) == 2) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}
