fn.cpp
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
using namespace std;
#define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++)
#define FORD(prom, a, b) for(int prom = (a); prom > (b); prom--)
#define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--)
#define PB push_back
#define MP make_pair
#define MM(co, cim) memset((co), (cim), sizeof((co)))
#define DEB(x) cerr << ">>> " << #x << " : " << x << endl;
int p[10005];
int main ()
{
int m,n,a,b;
while(cin >> n >> m){
MM(p,0);
FOR(i,0,m){
cin >> a >> b;
p[a-1] ++;
p[b-1] ++;
}
bool ok = false;
FOR(i,0,n)
if(p[i] >= 4){
ok = true;
break;
}
if(ok)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}