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 = {
    val (maxCnt, _) = ds.foldLeft((0,0)) { case ((maxCnt, tmpCnt), (d1, d2)) =>
      if(d1 == d2) (Math.max(maxCnt, tmpCnt+1), tmpCnt+1)
      else (maxCnt, 0)
    }
    if(maxCnt >= 3) "Yes" else "No"
  }

  println(solve())

}

