import scala.io.StdIn._

object Main extends App {


  val n = readInt()
  val ds = Array.fill(n)(readLine().split(" ").map(_.toInt))
    .map(list => (list(0), list(1)))
  def solve(): String = {
    ds.foldLeft(0) { case (acc, (d1, d2)) =>
      if(acc >= 3) return "Yes"
      if(d1 == d2) acc+1 else 0
    }
    "No"
  }

  println(solve())

}

