#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
set<pair<long long, long long> > st;
set<pair<long long, long long> >::iterator p;
int A[300001], i, j, n, m, k, t;
string s;
int x, x1, y, yy, yt, ytt, a, b, q = 1, q1 = 1, t1;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> n >> m >> x >> x1;
  for (i = 0; i < m - 1; i++) {
    cin >> a >> b;
    if (a == x || b == x)
      true;
    else if (t == 0)
      y = a, yt = b, t = 1;
    else {
      if (a != y && b != y) y = -1;
      if (a != yt && b != yt) yt = -1;
      if (a != y && a != yt && b != y && b != yt) q = 0;
    }
    if (a == x1 || b == x1)
      true;
    else if (t1 == 0)
      yy = a, ytt = b, t1 = 1;
    else {
      if (a != yy && b != yy) yy = -1;
      if (a != ytt && b != ytt) ytt = -1;
      if (a != yy && a != ytt && b != yy && b != ytt) q1 = 0;
    }
  }
  q || q1 ? cout << "YES" : cout << "NO";
  return 0;
}
