//
// File: fn.cc
// Author: cteam030
//
// Created on October 19, 2013, 2:30 PM
//
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
//
//
//
vector<vector<bool> > banned_pts;
bool routeFound(int pt1, int pt2, vector<int> next_pts[]);
int main(int argc, char** argv) {
int pts, lns;
while(cin >> pts >> lns) {
vector<int> next_pts[pts+1];
bool found = false;
for(int i = 0; i < lns; i++) {
int pt1,pt2;
cin >> pt1 >> pt2;
next_pts[pt1].push_back(pt2);
next_pts[pt2].push_back(pt1);
if(next_pts[pt1].size()>=4 || next_pts[pt2].size() >= 4)
found = true;
}
if(found) {
cout << "YES\n";
} else {
vector<int> foo;
for(int i = 1; i<= pts+1;i++) {
if(next_pts[i].size()>=3)
foo.push_back(i);
}
if(foo.size()<2) {
cout << "NO\n";
}else{
int i=0;
bool br = false;
while(i < foo.size()-1 && !br) {
int j=i+1;
while(j < foo.size() && !br) {
banned_pts.clear();
banned_pts.resize(pts);
for(int k = 0; k<=pts; k++){
for(int l = 0;l<=pts; l++)
banned_pts[k].push_back(false);
}
if(routeFound(foo[i], foo[j], next_pts)) {
found = true;
br = true;
}
j++;
}
i++;
}
if(found)
cout << "YES\n";
else
cout << "NO\n";
}
}
}
return (0);
}
bool routeFound(int pt1, int pt2, vector<int> next_pts[]) {
if(pt1==pt2)
return true;
bool res = false;
for(int i = 0; i<next_pts[pt1].size(); i++) {
if(!banned_pts[pt1][pt2]) {
banned_pts[pt1][pt2] = true;
banned_pts[pt2][pt1] = true;
res = res || routeFound(next_pts[pt1][i], pt2, next_pts);
}
}
return res;
}