program doubledots
implicit none
integer m, n, i, j, lenj,lenjnew, k, l
integer a, b
integer, allocatable :: roomini(:), roomnew(:), path(:,:), roomind(:)
read *, n, m
allocate(roomini(n), roomnew(n), roomind(n), path(n,n))
path(:,:)=0
do i=1, m
  read *, a, b
  path(a,b) = 1
  path(b,a) = 1
end do
roomini(:)=0
roomini(1)=1
lenj = 1
roomind = 0
path(1,:)=0
do i=1, n
  lenjnew = 0
  do j=1, lenj
    do k=1, n
      if(path(k,roomini(j))==1) then
        lenjnew = lenjnew + 1
        roomnew(lenjnew) = k
        roomind(k) = roomini(j)
        path(k,:)=0
      end if
    end do
  end do
  lenj = lenjnew
  roomini = roomnew
!  print *, i, lenj
!  print *, roomini(:)
!  print *, roomind(:) 
end do
l=0
do i=2,n
  if(roomind(i)>0) then
    l = l+1
  end if
end do
if(l==n-1) then
  print *, 'Yes'
  do i=2,n
    print *, roomind(i)
  end do
else
  print *, 'No'
end if
end program