import Foundation

var r = Int(readLine()!)!
var i = 0
var j = 0
for _ in 0 ..< r {
    let arr=readLine()!.split{$0==" "}.map{Int(String($0))!}
        let n=arr[0]
        let a=arr[1]
    if a == n {
        i = i + 1
        if i > 2 {
           j = 1
        }
    }else{
        i = 0
    }
}

if j == 1 {
    print("Yes")
}else{
    print("No")
}