#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <iostream>
#include <vector>
#include <string>

#define pb push_back

using namespace std;
using ll = long long;
using ull = unsigned long long;
using dl = double;

const ll N = 200100;
const ll inf = 100000000000;

ifstream in("input.txt");
ofstream out("output.txt");

int n, m;
vector<int> p[N];

//vector<int> r (int v, vector<int> vs) {
//
//}

int main() {

    in >> n >> m;

    for (int i = 0; i < m; ++i) {
        int a, b;
        in >> a >> b;
        p[a].pb(b);
    }

    vector<int> path;
    int v = 1;
    for (int i = 0; i < n + 1; ++i) {
        v = p[i][0];
        path.pb(v);
    }
    if (v == 1) {
        out << "YES" << endl;
        for (int w : path) {
            out << w << " ";
        }
        out << endl;
    } else {
        out << "NO" << endl;
    }

    return 0;
}