import Data.List
import Control.Monad

main = do
    n <- readLn :: IO Int
    ws <- lines <$> getContents
    let p1 = and $ zipWith check ws (tail ws)
    let p2 = (== length ws) . length . group $ sort ws
    putStrLn $ if p1 && p2 then "Yes" else "No"

check w1 w2 = l == h
    where l = last w1
          h = head w2