import Control.Monad
import Data.List

main = do
    n <- read <$> getLine
    w <- forM [1..n] $ \i -> getLine
    putStrLn $ if solve w then "Yes" else "No"

solve :: [String] -> Bool
solve w = length w == length (group $ sort w) && doit (last $ head w) (tail w)
  where
    doit _ []     = True
    doit c (w:ws) = c == head w && doit (last w) ws