import Control.Monad
import Control.Monad.Primitive
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine

paint table (ab : abs) is js = do
  let h = head ab
  let l = last ab
  if elem h is
    then do
      p <- VUM.read table l
      when (p == 0) $ VUM.write table l h
    else do
      p <- VUM.read table h
      when (p == 0) $ VUM.write table h l
  let js' = if elem h is then (l : js) else (h : js)
  if abs /= []
    then paint table abs is js'
    else return js'

padding table abs is = do
  let abs' = partition (\ab -> (elem (head ab) is) || (elem (last ab) is)) abs
  js <- paint table (fst abs') is []
  when (snd abs' /= []) $ padding table (snd abs') js

main = do
  [n, m] <- getIntList
  abs <- getIntNList m
  table <- VUM.replicate (n + 1) 0 :: IO (VUM.IOVector Int)
  VUM.write table 1 1

  padding table abs [1]
  t <- VU.freeze table
  let t' = VU.tail (VU.tail t)
  if VU.length (VU.filter (== 0) t') /= 0
    then putStrLn "No"
    else do
      putStrLn "Yes"
      VU.mapM_ print t'
