let n = Int(readLine()!)!
var dArray = [[Int]]()
for _ in 0..<n {
  dArray.append(readLine()!.split(separator: " ").map {Int($0)!})
}

var sameCount = 0
var answer = "No"
var i = 0

while i < dArray.count {
  if sameCount == 3 {
    answer = "Yes"
    break
  }
  if dArray[i][0] == dArray[i][1] {
    sameCount += 1
  } else {
    sameCount = 0
  }
  i += 1
}

print(answer)