let n = Int(readLine()!)!
var c = 0
for i in 1...n{
  let d = readLine()!.split(separator:" ").map{Int($0)!}
  if d[0] == d[1]{
    c += 1
  }else{
    c = 0
  }
  if c == 3{
    print("Yes")
    break
  }
  if i == n{
    print("No")
  }
}