import Control.Monad

getInData = map read . words <$> getLine :: IO [Int]

solve :: [[Int]] -> Int -> Int
solve inData ans
 | ans == 3     = 3
 | inData == [] = ans
 | otherwise    = solve (tail inData) newAns
   where inFstData = head inData
         newAns    = if ((inFstData !! 0) == (inFstData !! 1)) then (ans + 1) else 0

main = do
 n <- read <$> getLine
 inData <- replicateM n getInData
 putStr $ if (solve inData 0) == 3 then "Yes" else "No"