object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN) = readLine.split(" ").map(_.toInt)
    val aryA = for(i <- 1 to datN) yield {
      val aryD = readLine.split(" ").map(_.toInt)
      aryD(0) == aryD(1)
    }

    var ans = false
    for(i <- 0 until (datN - 2)) {
      ans = ans || (aryA(i) == aryA(i + 1)) && (aryA(i) == aryA(i + 2))
    }

    println(if(ans) "Yes" else "No")
  }
}
