fun main(args: Array<String>) {
    val n = (readLine() ?: return).toInt()
    var successCount = 0
    var preZoromeCount = 0
    repeat(n) {
        val (dice1, dice2) = readLine()!!.split(" ").map(String::toInt)
        when (dice1 == dice2) {
            true -> {
                preZoromeCount += 1
                if (preZoromeCount == 3) {
                    successCount += 1
                    preZoromeCount = 0
                }
            }
            false -> preZoromeCount = 0
        }
    }
    print(when {
        successCount >= 1 -> "Yes"
        else -> "No"
    })
}