fun main() {
    val n = readLine()!!.toInt()
    var cnt = 0
    (0 until n).forEach {
        val d = readLine()!!.split(" ")
        if(d[0] == d[1]) {
            if((++cnt) == 3){
                print("Yes")
                return
            }
        } else {
            cnt = 0
        }
    }
    print("No")
}