#include<bits/stdc++.h>
using namespace std;

const int MAX = 555;
int N ,M, V;
vector<int> G[MAX];
vector<int> rG[MAX];
bool used[MAX];
int cmp[MAX];
vector<int> vs;

void add_edge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}
  
void dfs(int v){
  used[v] = true;
  for(int i = 0 ; i < (int)G[v].size() ; i++){
    if(!used[G[v][i]]) dfs(G[v][i]);
  }
  vs.push_back(v);
}
  
void rdfs(int v,int k){
  used[v] = true;
  cmp[v] = k;
  for(int i = 0 ; i < (int)rG[v].size() ; i++){
    if(!used[rG[v][i]]) rdfs(rG[v][i],k);
  }
}
  
int scc(){ //?????£?????????????§£????????????
  memset(used, 0, sizeof(used));
  vs.clear();
  for(int v = 0 ; v < V ; v++){
    if(!used[v]) dfs(v);
  }   
  memset(used, 0, sizeof(used));
  int k = 0;
  for(int i = vs.size() - 1 ; i >= 0 ; i--){
    if(!used[vs[i]]) rdfs(vs[i],k++);
  }
  return k;
}

int ord[MAX], low[MAX];
struct edgeB{
  int u,v;
};
 
void dfs(int u, int pre, int &c, vector<int> G[], vector<edgeB> &B){
  ord[u] = low[u] = c++;
  for(int i=0;i<(int)G[u].size();i++){
    int v = G[u][i];
    if(v != pre){
      if(ord[v] == -1){
        dfs(v,u,c,G,B);
        low[u] = min(low[u],low[v]);
      }
      else{
        low[u] = min(low[u],ord[v]);
      }
      if(ord[u] < low[v]) B.push_back((edgeB){u,v});
    }
  }
}
 
void bridge(int n, vector<int> G[], vector<edgeB> &B){
  B.clear();
  int c = 0;
  fill(ord,ord+n,-1);
  for(int i=0;i<n;i++) if(ord[i]==-1) dfs(i,-1,c,G,B);
}


int A[1111],B[1111];

void make_graph(int x){
  for(int i=0;i<N;i++) G[i].clear();
  for(int i=0;i<N;i++) rG[i].clear();
  for(int i=0;i<M;i++){
    if( i == x ) continue;
    add_edge( A[i], B[i] );
  }
}

void make_graph2(int x){
  for(int i=0;i<N;i++) G[i].clear();
  for(int i=0;i<M;i++){
    if( i == x ) continue;
    G[A[i]].push_back( B[i] );
    G[B[i]].push_back( A[i] );
  }
}

int main(){
  cin >> N >> M;  
  V = N;
  for(int i=0;i<M;i++){
    cin >> A[i] >> B[i]; --A[i]; --B[i];
  }
  if( N == 3 ){
    cout << "YES" << endl; return 0;
  } else if( M == N-1 ){
    cout << "NO" << endl; return 0;
  }
  
  for(int i=0;i<M;i++){
    make_graph(i);
    int n = scc();
    if( n == N ){
      make_graph2(i);
      vector<edgeB> E;
      bridge( N, G, E );
      if( E.size() >= 2 ) {
	cout << "YES" << endl; return 0;
      }
    }
  }
  cout << "NO" << endl;
}