import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let n = Int(readLine()!)!
var count = 0
var ans = "No"
for _ in 0..<n {
  let (dl, dr) = toTuple(readInts())
  if dl == dr {
    count += 1
  } else {
    count = 0
  }
  if count == 3 {
    ans = "Yes"
  }
}
print(ans)