#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;

#define pb push_back
typedef long long ll;

const int nmax=200010;

tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ost;

int mas[nmax]={0},used[nmax]={0};
int dp[nmax][2]={0};
vector<int> graf[nmax],topsort;

void dfs(int v) {
    used[v]=1;
    for(int i:graf[v]) {
        if(used[i]) {
            continue;
        }
        dfs(i);
    }
    topsort.pb(v);
    return ;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,m,u,v;
    cin >> n >> m;
    for(int i=0;i<m;i++) {
        cin >> u >> v;
        graf[u].pb(v);
        graf[v].pb(u);
    }
    dfs(1);
    reverse(topsort.begin(),topsort.end());
    if(topsort.size()!=n) {
        cout << "NO\n";
        return 0;
    }
    cout << "NO\n";
    //assert(0);
    return 0;
}
