fun main(args: Array<String>) {
  val n: Int = readLine()!!.toInt()
  val list: MutableList<List<Int>> = mutableListOf()
  for (i in 1..n) {
    list.add(readLine()!!.split(" ").map { it.toInt() })
  }
  var answer: String = "No"
  for (i in 0..list.size - 3) {
    var one: Boolean = false
    var two: Boolean = false
    var three: Boolean = false
    if (list[i][0] == list[i][1]) one = true
    if (list[i + 1][0] == list[i + 1][1]) two = true
    if (list[i + 2][0] == list[i + 2][1]) three = true
    if (one && two && three) {
      answer = "Yes"
      break
    }
  }
  println(answer)
}