#include #define lowbit(x) x & (-x) #define ls(k) k << 1 #define rs(k) k << 1 | 1 #define fi first #define se second #define ctz(x) __builtin_ctz(x) #define popcnt(x) __builtin_popcount(x) #define open(s1, s2) freopen(s1, "r", stdin), freopen(s2, "w", stdout); using namespace std; typedef __int128 __; typedef long double lb; typedef double db; typedef unsigned long long ull; typedef long long ll; bool Begin; const int N = 2e4 + 10; inline ll read(){ ll x = 0, f = 1; char c = getchar(); while(c < '0' || c > '9'){ if(c == '-') f = -1; c = getchar(); } while(c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void write(ll x){ if(x < 0){ putchar('-'); x = -x; } if(x > 9) write(x / 10); putchar(x % 10 + '0'); } int n, m, u, v; vector E[N], V[N]; inline void add(int u, int v){ E[u].push_back(v); E[v].push_back(u); } bool End; int main(){ n = read(), m = read(); while(m--){ u = read(), v = read(); add(u, v); } for(auto u : E[1]){ for(auto v : E[u]){ if(v == 1) continue; if((int)V[v].size() < 3) V[v].push_back(u); } } for(int i = 2; i <= n; ++i){ for(int v : E[i]){ for(int j = 0; j < V[i].size(); ++j){ for(int k = 0; k < V[v].size(); ++k){ if(V[i][j] != v && V[i][j] != V[v][k] && V[v][k] != i){ puts("YES"); return 0; } } } } } puts("NO"); cerr << '\n' << abs(&Begin - &End) / 1048576 << "MB"; return 0; }