import numpy as np
room, route_count = map(int,input().split())
route = np.array([list(map(int,input().split())) for _ in range(route_count)])
 
object_nums = [1]
ans = np.array([0]*(room-1))
 
def mem_ans(ans, object_num, next_nums):
    next_nums = next_nums - 2
    ans[next_nums-2] = object_num
    return ans
 
for object_num in object_nums:
    object_rows = route[np.any(route==object_num, axis=1)]
    route = route[~np.any(route==object_num, axis=1)]
    next_nums = object_rows[object_rows!=object_num]
    
    if next_nums is not None:
        ans = mem_ans(ans, object_num, next_nums)
        object_nums.extend(next_nums)
    else:
        break
if 0 in set(ans):
  print('No')
else:
  print('Yes')
  for i in ans:
    print(i)