object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val d = List.fill(n)(sc.nextInt() == sc.nextInt())
  var ok = false
  for (i <- 0 to n-3 if d(i) && d(i+1) && d(i+2)) {
    ok = true
  }
  println(if (ok) "Yes" else "No")
}
