import           Control.Monad

inputN :: IO Int
inputN = readLn

inputDs :: Int -> IO [(Int, Int)]
inputDs n = do
  ns <- replicateM n (map read . words <$> getLine)
  return . map (\[x, y] -> (x, y)) $ ns

check :: [(Int, Int)] -> Bool
check x = func x 0
  where
    func :: [(Int, Int)] -> Int -> Bool
    func [] c = if c >= 3 then True else False
    func (n:ns) c = case fst n == snd n of
      True  -> if c == 2 then True else func ns (c+1)
      False -> func ns 0

main :: IO ()
main = do
  n <- inputN
  ns <- inputDs n
  putStrLn . (\x -> if x then "Yes" else "No") . check $ ns
  return ()
