#include<iostream>
using namespace std;
short * paws;
bool ** graph;
unsigned N;
bool isPaw(unsigned point) {
if(paws[point] != -1)
return (bool) paws[point];
else {
bool con = false;
for(unsigned i = 0; i < N; i++) {
if(graph[point][i] == 1) {
if (con) {
paws[point] = 0;
return false;
} else {
con = true;
}
}
}
paws[point] = 1;
return true;
}
}
bool isBunny(unsigned point) {
short paws = 0;
for(unsigned i = 0; i < N; i++) {
if(graph[point][i] == 1) {
if(++paws > 4) {
return false;
}
}
}
if (paws == 4)
return true;
else
return false;
}
int main() {
unsigned points;
unsigned lines;
while(cin >> points >> lines) {
graph = new bool * [points];
for (unsigned i = 0; i < points; i++) {
graph[i] = new bool [points];
for (unsigned j = 0; j < points; j++) {
graph[i][j] = false;
}
}
paws = new short [points];
for (unsigned i = 0; i < points; i++)
paws[i] = -1;
for (unsigned i = 0; i < lines; i++) {
unsigned x, y;
cin >> x >> y;
graph[x-1][y-1] = true;
graph[y-1][x-1] = true;
}
N = points;
bool found = false;
for (unsigned i = 0; i < N; i++) {
if(isBunny(i)) {
cout << "YES" << endl;
found = true;
break;
}
}
if (!found)
cout << "NO" << endl;
delete [] paws;
for (unsigned i = 0; i < points; i++) {
delete [] graph[i];
}
delete [] graph;
}
return 0;
}