fun main(args: Array<String>) {
    var n = readLine()!!.toInt()
    var ans=0
    repeat(n){
        var (x,y) = readLine()!!.split(" ").map(String::toInt)
        if (ans==3) {
            println("Yes")
            return
        }
        if (x==y){
            ans+=1
        }else{
            ans=0
        }
    }
    if (ans>=3) {
        println("Yes")
    }else{
        println("No")

    }
}