{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
  -- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Applicative
import           Debug.Trace


readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons

main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  g <- replicateM m $ (\vec -> [(vec VU.! 0, vec VU.! 1),(vec VU.! 1, vec VU.! 0)]) <$> getIntVector
  let -- g' = map (\(a,b) -> (b,a)) g
      gr = ([1..n],concat g)
      minimumPaths = map ((\n -> foldl1' solve $ dfs gr n 1)) $ [2..n]
      ans = map (\n -> n !! 1) minimumPaths
      -- ans = map (\n -> n - 1) $ map (length . (\n -> foldl1' solve $ dfs gr n 1)) $ [2..n]
  putStrLn "Yes"
  forM_ ans $ \i -> do
    print i

test = [[4,3,2,1],[4,2,1]]

solve n m = if length n <= length m then n else m


type Graph = ([Int],[(Int, Int)])
next n = (map snd) . (filter ((n ==) .fst))

gr0 :: Graph
gr0 = ([1,2,3,4,5,6,7,8,9],
       [(1,2),(1,3),(1,4),(2,5),(3,5),(3,6),(4,7),(5,1),(6,7),(6,8),(7,9),(8,4)])

findNext :: Int -> Graph -> [Int]
findNext k gr = map snd . filter ((==k) . fst) $ snd gr

dfs :: Graph -> Int -> Int -> [[Int]]
dfs gr p0 p1 = dfsAux gr p0 p1 []
  where
    dfsAux gr p0 p1 path
      | p0 == p1 = return (reverse (p1:path))
      | otherwise = msum $ map (\p -> dfsAux gr p p1 (p0:path)) [x | x <- findNext p0 gr, not (x `elem` path)]

-- bfs :: Graph -> Int -> Int -> [[Int]]
-- bfs gr p0 p1 = bfsAux gr p1 [x : [p0] | x <- findNext p0 gr]
--   where
--     bfsAux _ _ [] = fail "no Path"
--     bfsAux gr p1 (path:queue)
--       | p0 == p1 = (return (reverse path)) YY (bfsAux gr p1 queue)
--       | otherwise = bfsAux gr p1 (queue ++ [ x : path | x <- findNext p0 gr, not (x Y path)])
--       where p0 = head path
