#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;

template<typename T> bool chmin(T &a,T b){return (a>b)?(a=b,1):0;}

// Description: ??°??????????????????(?????????????°??????¨???)
// Verifyed: Many Diffrent Problem 

//Appropriately Changed
using edge=struct{int to;};
using G=vector<vector<edge>>;

//Appropriately Changed
void add_edge(G &graph,int from,int to){ 
	graph[from].push_back({to});
}

auto low_link(const G& graph){
    int n=graph.size(),k=0;
    vector<int> par(n),ord(n,-1),low(n),root(n,0);

    auto dfs=[&](int v,int p,int &k){
        auto func=[&](int v,int p,int &k,auto func)->void{
            ord[v]=k++,low[v]=ord[v],par[v]=p;
            for(auto &e:graph[v]){
                if(e.to==p) continue;
                if(ord[e.to]==-1)
                    func(e.to,v,k,func),chmin(low[v],low[e.to]);
                else
                    chmin(low[v],ord[e.to]);
            }
        };
        return func(v,p,k,func);
    };

    rep(v,n) if(ord[v]==-1) dfs(v,-1,k),root[v]=1;
    return make_tuple(par,ord,low,root);
}

auto bridge(const G& graph){
    const int n=graph.size();
    vector<int> par,ord,low,root;
    tie(par,ord,low,root)=low_link(graph);

    using state=tuple<int,int>;
    vector<state> res;
    rep(v,n){
        if(par[v]==-1) continue;
        if(ord[v]<low[par[v]]||ord[par[v]]<low[v]){
            auto in=state(v,par[v]);
            if(get<1>(in)<=get<0>(in)) swap(get<0>(in),get<1>(in));
            res.push_back(in);
        }
    }
    return res;      
}

bool cycle;
bool used[510];

void dfs(const G &graph,int v,int s){
	used[v]=true;
	for(auto &e:graph[v]){
		if(used[e.to]){
			if(e.to==s) cycle=true;
		}else
			dfs(graph,e.to,s);
	}
}


int a[1010],b[1010];

int main(void){
	int n,m;
	cin >> n >> m;
	rep(i,m) cin >> a[i] >> b[i],a[i]--,b[i]--;

	bool ok=false;

	rep(bad,m){
		G graph(n),bgraph(n);
		rep(i,m) if(i!=bad) add_edge(graph,a[i],b[i]),add_edge(bgraph,a[i],b[i]),add_edge(bgraph,b[i],a[i]);
		auto target=bridge(bgraph);
		if(target.size()<2) continue;

		cycle=false;
		rep(i,n){
			fill(used,used+n,false);
			dfs(graph,i,i);
		}
		if(cycle==false) ok=true;
	}
	
	if(ok)
		puts("YES");
	else
		puts("NO");

	return 0;
}