#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;

#define all(x)  x.begin(),x.end()
#define v(x) vector<x>
#define nl '\n'
#define fxd(x) fixed << setprecision(x)
template<class t> using ordered_set = tree<t, null_type, less<t>, rb_tree_tag, tree_order_statistics_node_update>;
template<class t> using ordered_multiset = tree<t, null_type, less_equal<t>, rb_tree_tag, tree_order_statistics_node_update>;
vector<pair<ll,ll>> prs;
int n , m;
/* 
 function that takes x and y and check if in every pair atleast one element equal x or y if yes it returns -1 
 if no and and in a pair this condions dosn't hold then it returns the index of the pair that breaks the condition
 */
ll check(ll x , ll y)
{
    for (int i = 0; i < m; i++)
    {
        // note that i search if there's any problem found here if yes i return the index of the pair that is nigga
        if(!(x == prs[i].first || x == prs[i].second || y == prs[i].first || y == prs[i].second)) return i;
    }
    // this happen when every pair is ok with this x and y (allhamdullah);
    return -1;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //just take the input stuff
    cin >> n >> m;
    prs.resize(m);
    for (int i = 0; i < m; i++)
    {
        cin >> prs[i].first >> prs[i].second;
    }

    
    ll stat; // this store if the current x and y work or not
    ll fail; // this stores the index that have a problem with current x 

    
    stat = check(prs[0].first,-1); // we try the first element in the first pair note that i put y = -1 because it's ganted that the values will not equal -1
    if(stat == -1)
    {
        // dame bro the first element of the first pair works on it's own this good
        cout << "YES";
        return 0;
    }
    else
    {
        // ok now the first elemnt of the first index faild so we will try to take y from the first
        fail = stat;
        stat = check(prs[0].first,prs[fail].first);
        if(stat == -1)
        {
            cout << "YES";
            return 0;
        }
        else
        {
            // ok the first element of the faild pair also falid to be the y so we try the second one
            stat = check(prs[0].first,prs[fail].second);
            if(stat == -1)
            {
                cout << "YES";
                return 0;
            }
        }
    }
    
    // now we lowkey now that the first element of the first piar dosen't work to be our x (ab3d allah 3nkm al exat) so we try the secend element of the first pair to be the x
    stat = check(prs[0].second,-1);
    if(stat == -1)
    {
        // the seconde element can work on it's own 
        cout << "YES";
        return 0;
    }
    // we try the same shit again
    else
    {
        fail = stat;
        stat = check(prs[0].second,prs[fail].first);
        if(stat == -1)
        {
            cout << "YES";
            return 0;
        }
        else
        {
            stat = check(prs[0].second,prs[fail].second);
            if(stat == -1)
            {
                cout << "YES";
                return 0;
            }
        }
    }
    // so now we know that we cant use any elements in the first pair so ofc there's no solution
    cout << "NO";
    return 0;
}