import sys
input = sys.stdin.readline

N,M = map(int,input().split())
A = [None]*M
B = [None]*M
for i in range(M):
    A[i],B[i] = map(int,input().split())

route_flag = [0]*(N+1)
route_flag[1] = 1
route = [None] * (N+1)
path_clear = 0


while path_clear < M:
    k = 0
    length = len(A)
    for i in range(length):
        if route_flag[A[i-k]] == 1 and route_flag[B[i-k]] == 0:
            route_flag[B[i-k]] = 1
            path_clear += 1
            route[B[i-k]] = A[i-k]
            del A[i-k]
            del B[i-k]
            k += 1
        elif route_flag[B[i-k]] == 1 and route_flag[A[i-k]] == 0:
            route_flag[A[i-k]] = 1
            path_clear += 1
            route[A[i-k]] = B[i-k]
            del A[i-k]
            del B[i-k]
            k += 1
        elif route_flag[A[i-k]] == 1 and route_flag[B[i-k]] == 1:
            del A[i-k]
            del B[i-k]
            path_clear += 1
            k += 1

    if k == 0:
            print('No')
            sys.exit()

route = route[2:]
print('Yes')
for i in range(len(route)):
    print(route[i])
