fn.cpp
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
const static int MAX = 10050;
int poi[MAX];
bool load()
{
int points, lines;
bool bunny = false;
if (scanf("%d%d", &points, &lines) != 2)
return false;
for(int i=0; i<MAX; i++)
poi[i] = 0;
for (int i = 0; i < lines; ++i)
{
int from, to;
scanf("%d%d", &from, &to);
poi[from]++;
poi[to]++;
if(poi[from] >=4 || poi[to] >=4)
bunny = true;
}
if(bunny)
cout << "YES" << endl;
else
cout << "NO" << endl;
return true;
}
int main()
{
while (load()) {}
return 0;
}