import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val ds = (1..n*2).map { sc.nextInt() }

    println(calc(ds))
}

fun calc(ds: List<Int>): String {
    var cnt = 0
    var maxCnt = 0
    for(i in ds.indices step 2) {
        if(ds[i] == ds[i+1]) {
            cnt++
        }
        else {
            if(cnt > maxCnt) maxCnt = cnt
            cnt = 0
        }
    }
    if(cnt > maxCnt) maxCnt = cnt
    return if(maxCnt >= 3) "Yes" else "No"
}