# D



import numpy as np

from scipy.sparse import csr_matrix

from scipy.sparse.csgraph import breadth_first_order



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



row = []

col = []

for i in range(M):

    r, c = list(map(int, input().split()))

    row.append(c-1)

    col.append(r-1)



data = [1] * (M)



csr = csr_matrix((data, (row, col)), shape=(N, N))

_, proc = breadth_first_order(csr, 0, directed=False)



if -9999 in proc[1:]:

  print('No')

else:

  print('Yes')

  print(('\n'.join((proc[1:]+1).astype('str'))))
# D



import numpy as np

from scipy.sparse import csr_matrix

from scipy.sparse.csgraph import breadth_first_order



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

ABs = np.array([list(map(int, input().split())) for i in range(M)])



row = ABs.T[0]-1

col = ABs.T[1]-1

data = [1] * (M)



csr = csr_matrix((data, (row, col)), shape=(N, N))

_, proc = breadth_first_order(csr, 0, directed=False)



if -9999 in proc[1:]:

  print('No')

else:

  print('Yes')

  print(('\n'.join((proc[1:]+1).astype('str'))))
# D
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import breadth_first_order

N, M = list(map(int, input().split()))
row = []
col = []
for i in range(M):
    r, c = list(map(int, input().split()))
    row.append(c - 1)
    col.append(r - 1)
data = [1] * (M)
csr = csr_matrix((data, (row, col)), shape=(N, N))
_, proc = breadth_first_order(csr, 0, directed=False)
if -9999 in proc[1:]:
    print("No")
else:
    print("Yes")
    print(("\n".join((proc[1:] + 1).astype("str"))))

# D
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import breadth_first_order

N, M = list(map(int, input().split()))
ABs = np.array([list(map(int, input().split())) for i in range(M)])
row = ABs.T[0] - 1
col = ABs.T[1] - 1
data = [1] * (M)
csr = csr_matrix((data, (row, col)), shape=(N, N))
_, proc = breadth_first_order(csr, 0, directed=False)
if -9999 in proc[1:]:
    print("No")
else:
    print("Yes")
    print(("\n".join((proc[1:] + 1).astype("str"))))

-row = [] -col = [] -for i in range(M): -    r, c = list(map(int, input().split())) -    row.append(c - 1) -    col.append(r - 1) +ABs = np.array([list(map(int, input().split())) for i in range(M)]) +row = ABs.T[0] - 1 +col = ABs.T[1] - 1