import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    d <- replicateM n $ do
            [d1,d2] <- getIntList
            return $ d1 == d2
    let f (m,s) p | p = (max m (s+1), s+1)
                  | otherwise = (m,0)
    let ans = fst $ foldl' f  (0,0) d
    putStrLn $ if ans >= 3 then "Yes" else "No"