#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996) #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define pb push_back #define mp(a,b) make_pair(a,b) #define all(a) a.begin(),a.end() #define len(x) ((int)(x).size()) #define tmax(a,b,c) max((a),max((b),(c))) #define debug(x) cerr << #x << " is " << x << endl; typedef pair Pii; typedef vector V; typedef vector > VV; typedef long long ll; const int inf = 2e9; const int mod = 1e9 + 7; const long double eps = 1e-10; int N, M; V E1[20001]; unordered_set E2[20001]; int main() { cin >> N >> M; rep(i,0,M) { int a, b; cin >> a >> b; a--; b--; E1[a].pb(b); E1[b].pb(a); } for (int b: E1[0]) { for (int c: E1[b]) { if (c==0) continue; E2[c].insert(b); //printf("b=%d c=%d\n",b,c); } } rep(i,0,M-1) { if (!E2[i].size()) continue; rep(j,i+1,M) { if (!E2[j].size()) continue; //printf("i=%d j=%d\n",i,j); auto it = find(all(E1[i]), j); if (it != E1[i].end()) { if (E2[i].size() == 1 && E2[j].size() == 1 && E2[i] != E2[j] || E2[i].size()>=1 && E2[j].size()>=1 && max(E2[i].size(), E2[j].size())>=2) { cout << "YES" << endl; return 0; } } } } cout << "NO" << endl; return 0; }