from scipy.sparse.csgraph import breadth_first_tree, breadth_first_order

from scipy.sparse import csr_matrix, coo_matrix

N, M = list(map(int,input().split()))

A = []

B = []

for i in range(M):

    a, b = list(map(int,input().split()))

    a -= 1

    b -= 1

    A.append(a)

    B.append(b)

D = [1] * M

csr = coo_matrix((D, (A, B)), (N, N)).tocsr()

Tcsr = breadth_first_order(csr, 0, False, True)

ans = []

for i in Tcsr[1][1:]+1:

    if i == -9998:

        print("No")

        quit()

    ans.append(i)

print("Yes")

for i in ans:

    print(i)
from scipy.sparse.csgraph import breadth_first_tree, breadth_first_order

from scipy.sparse import csr_matrix, coo_matrix

import sys

input = sys.stdin.readline

N, M = list(map(int,input().split()))

A = []

B = []

for i in range(M):

    a, b = list(map(int,input().split()))

    a -= 1

    b -= 1

    A.append(a)

    B.append(b)

D = [1] * M

csr = coo_matrix((D, (A, B)), (N, N)).tocsr()

Tcsr = breadth_first_order(csr, 0, False, True)

ans = []

for i in Tcsr[1][1:]+1:

    if i == -9998:

        print("No")

        quit()

    ans.append(i)

print("Yes")

for i in ans:

    print(i)
from scipy.sparse.csgraph import breadth_first_tree, breadth_first_order
from scipy.sparse import csr_matrix, coo_matrix

N, M = list(map(int, input().split()))
A = []
B = []
for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    A.append(a)
    B.append(b)
D = [1] * M
csr = coo_matrix((D, (A, B)), (N, N)).tocsr()
Tcsr = breadth_first_order(csr, 0, False, True)
ans = []
for i in Tcsr[1][1:] + 1:
    if i == -9998:
        print("No")
        quit()
    ans.append(i)
print("Yes")
for i in ans:
    print(i)

from scipy.sparse.csgraph import breadth_first_tree, breadth_first_order
from scipy.sparse import csr_matrix, coo_matrix
import sys

input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = []
B = []
for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    A.append(a)
    B.append(b)
D = [1] * M
csr = coo_matrix((D, (A, B)), (N, N)).tocsr()
Tcsr = breadth_first_order(csr, 0, False, True)
ans = []
for i in Tcsr[1][1:] + 1:
    if i == -9998:
        print("No")
        quit()
    ans.append(i)
print("Yes")
for i in ans:
    print(i)

+import sys +input = sys.stdin.readline