main = do
  li <- getLine
  let n = read li
  co <- getContents
  let dds = map (l2p . map read . words) $ lines co
  let ans = compute n dds
  putStrLn $ if ans then "Yes" else "No"

l2p [a,b] = (a,b)

compute :: Int -> [(Int,Int)] -> Bool
compute n dds = loop bs
  where
    bs = [d1 == d2 | (d1,d2) <- dds]

loop (True:True:True:_) = True
loop (_:_:False:bs) = loop bs
loop (_:False:bs) = loop bs
loop (False:bs) = loop bs
loop _ = False