let n = Int(readLine()!)!

var hit = 0

var ans = "No"

for _ in 0..<n {
  let inp = readLine()!.split(separator: " ").map { Int($0)! }
  if inp[0] == inp[1] {
    hit += 1
  } else {
    hit = 0
  }
  if hit == 3 {
    ans = "Yes"
    break
  }
}
print(ans)