#include <bits/stdc++.h>
#define ll long long
#define ff first
#define pb push_back
#define ss second
#define endl '\n'
#define y1 y6
#define j1 j6
#define rr return 0
using namespace std;
ll n,i,o,d,m,j,x,y;
const ll INF=1e9;
vector < ll > v[100007];
set < ll > st;
ll B[100007];
ll q=0;
void rec (ll k)
{
    if(k==0 && q==1) {exit(0);}
    q=1;
    for(i=0;i<v[k].size();i++)
    {
        if(B[v[k][i]]==0) {B[v[k][i]]=1; cout<<v[k][i]+1<<" "; rec(v[k][i]); B[v[k][i]]=0;}
    }
}
int main()
{
//    freopen("loganqueries.in","r",stdin);
//    freopen("loganqueries.out","w",stdout);
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
//    cout.tie(0);
    cin>>n>>m;
    ll q=0;
    for(i=0;i<m;i++)
    {
        cin>>x>>y;
        x--; y--;
        v[x].pb(y);
        if(y==0) q=1;
    }
    if(v[0].size()==0 || q==0)
    {
        cout<<"NO"; rr;
    }


//    for(i=0;i<n;i++)
//    {
//        cout<<i<<": ";
//        for(o=0;o<v[i].size();o++)
//        {
//            cout<<v[i][o]<<" ";
//        }
//        cout<<endl;
//    }
    q=0;
    cout<<"YES"<<endl;
    cout<<"1 ";
    rec(0);
    cout<<"NO";
    return 0;
}

