import Foundation

func readInt() -> [Int]{
    return readLine()!.split(separator:" ").map{Int($0)!}
}
let n = Int(readLine()!)!
var c = 0
var max = 0
for i in 1...n{
  let m = readInt()
  if(m[0] == m[1]){
    c += 1
    if(max < c){
      max = c
    }
  }else{
    c = 0
  }
}
if(max >= 3){
  print("Yes")
}else{
  print("No")
}


