#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define pb push_back

using namespace std;

vector <vector <int>> g;
vector <bool> used;
vector <int> path;


void dfs (int k){
    // cout << "checking "<<k << '\n';
    // cout << "used p: ";
    // for(auto i : used)
    //     cout << i << ' ';
    // cout << '\n';
    if(path.size() == g.size()){
        //cout << "path found\n";
        return;
    }
    for(int i = 0; i < g[k].size(); i++){
        if(!used[g[k][i]]){
            used[g[k][i]] = true;
            path.pb(g[k][i]);
            dfs(g[k][i]);
            //cout << "return to  "<<k << '\n';
            if(path.size() == g.size())
                return;
            used[g[k][i]] = false;
            path.erase(path.end()-1);
        }
        else{
            //cout << g[k][i] << " has already been used\n";
        }
    }
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	int n, m;
	cin>>n >> m;
    g.resize(n);
    for(int i = 0; i<m; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].pb(b);
    }

    // for(auto i:g[4])
    //     cout << i << ' ';
    // cout << '\n';

    used.resize(n);
    used[0] = true;
    path.pb(0);
    dfs(0);
    if(path.size() == n){
        cout << "YES\n";
        for(auto i:path){
            cout << i + 1 <<' '; 
        }
        cout << 1;
    }
    else{
        cout << "NO";
    }

}
