#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<int> dfs (int k, vector <bool> used, vector <int> path){
    // 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 path;
    }
    vector <int> ans;
    for(int i = 0; i < g[k].size(); i++){
        if(!used[g[k][i]]){
            vector <bool> used1 = used;
            used1[g[k][i]] = true;
            vector <int> path1 = path;
            path1.pb(g[k][i]);
            ans = dfs(g[k][i], used1, path1);
            //cout << "return to  "<<k << '\n';
            if(ans.size() == g.size())
                return ans;
        }
        else{
            //cout << g[k][i] << " has already been used\n";
        }
    }
    return ans;
}


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

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

}
