#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  set<pair<int, int>> s;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    s.emplace(a, b);
  }
  vector<pair<int, int>> v;
  for (auto& i : s) v.emplace_back(i);
  vector<int> v2 = {v[0].first, v[0].second};
  for (int a : v2) {
    set<int> st;
    bool start = false;
    for (int i = 0; i < v.size(); ++i) {
      if (v[i].first == a or v[i].second == a)
        continue;
      else {
        if (!start) {
          start = true;
          st.emplace(v[i].first);
          st.emplace(v[i].second);
        } else {
          set<int> st2;
          if (st.count(v[i].first)) st2.insert(v[i].first);
          if (st.count(v[i].second)) st2.insert(v[i].second);
          st = st2;
          if (st.empty()) break;
        }
      }
    }
    if (!start or !st.empty()) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
