import Control.Monad
import Data.List

main:: IO ()
main = do
  n <- readLn
  ws <- replicateM n getLine
  print $ isFollowRules ws

isFollowRules :: [String] -> Bool
isFollowRules ws = not (hasDuplication ws) && isShiritori ws

hasDuplication :: (Eq a) => [a] -> Bool
hasDuplication xs = xs /= nub xs

isShiritori :: [String] -> Bool
isShiritori [] = True
isShiritori [_] = True
isShiritori [x, y] = last x == head y
isShiritori (x:y:xs) = last x == head y && isShiritori (y:xs)
