import Control.Applicative
import Control.Monad
import Data.List
import Data.Bool (bool)

main :: IO ()
main = do
  n <- readLn
  solve <$> replicateM n getLine >>= putStrLn

solve :: [String] -> String
solve ss = bool "No" "Yes" $ b1 && b2
  where
    b1 = all (\(x, y) -> head x == last y) $ zip (tail ss) ss
    b2 = all ((== 1) . length) . group . sort $ ss
