import Data.List
import Control.Monad
main = do
  n <- readLn
  w <- replicateM n getLine
  putStrLn $ if f w then "Yes" else "No"
f x
  | length x == 1 = True
  | length (nub x) < length x = False
  | last (head x) == head (head (tail x)) = f (tail x)