fun main(args: Array<String>) {
    val N = readLine()!!.toLong();

    var i = 1
    var sameCounter = 0
    while (i <= N) {
        val dd = readLine()!!.toString().split(" ")
        if (dd[0].toLong()==dd[1].toLong()) {
            sameCounter++
            if (sameCounter==3){
                println("Yes")
                return
            }
        } else {
            sameCounter = 0
        }
        i++
    }

    println("No")
}