import Control.Monad

main :: IO()
main = do
    n <- readLn
    list <- replicateM n getLine
    --replicateM n getLine←これ使う
    --let list = scan n
    if loop list n == False 
        then putStrLn "No" 
        else ( if siritori == True then putStrLn "Yes" else putStrLn "No" )

{-
scan :: String -> IO [String]
scan 0 = return []
scan n = do
    w <- getLine
    l <- scan $ n-1
    return w:l
-}


loop :: [String] -> Int -> Bool
loop (s1:s_long) n
    | ((n-1) == 0 ) = True
    | (s1 == (s_long !! n)) = False
    | otherwise =  loop s_long (n-1)
--loop (s1:s2:s_long) = elemm x xs

{-
elemm :: (Eq a) => a -> [a] -> Bool
elemm a [] = False
elemm a (x:xs)
    | ( x == a ) = True
    | otherwise = elemm a xs
-}


siritori :: [String] -> Int -> Bool
siritori list n
    | ( n == 1 ) = True
    | last (list !! (n-1)) /= head (list !! n) = False
    | otherwise = (siritori list (n-1))