object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val exists = List
    .fill(sc.nextInt())(sc.nextInt() == sc.nextInt())
    .sliding(3)
    .exists(_.forall(identity))
  println(if (exists) "Yes" else "No")
}
