import Foundation

func main() {
 var n = Int(readLine()!)!
 var successTimes = 0
 
 for _ in 1...n {
   let inputString = readLine()!
   let split: [Int] = inputString.components(separatedBy: " ").map{Int(String($0))!}
   if (split[0]==split[1]) {
     successTimes += 1
     if (successTimes == 3) {
        print("Yes")
        return
     }
   } else {
     successTimes = 0
   }
 }
 
 print("No")

}

main()