import Control.Monad

main :: IO()
main = do
    n <- readLn
    list <- replicateM n getLine
    {-replicateM n getLine←これ使うline送ってもらったしdiscodeにも書いてあるからそれ参考に頑張れ！-}
    --let list = scan n
    if loop list  == False
        then putStrLn "No" 
        else ( if (siritori list n ) > 0 then putStrLn "No" else putStrLn "Yes" )

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


loop :: [a] -> Bool
loop (x:xs) = elemm x xs

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

siritori :: [String] -> a -> Int
siritori list n
    | ( n == 0 ) = 0
    | last (list !! (n-1)) == head (list !! n) = 0 + (siritori list n-1)
    | otherwise = 1 + (siritori list n-1)