import Control.Monad
import Data.List
main = do
    n<-readLn::IO Int
    ws<-replicateM n getLine::IO [String]
    let ns = nub ws
    putStrLn $ chk ws ns
--
chk ws@(u:v) ns
    | length ws /= length ns = "No"
    | otherwise = chk2 u v
--
chk2 _ [] = "Yes"
chk2 u (v@(x:_):r)
    | last u /= x = "No"
    | otherwise = chk2 v r
