let n = Int(readLine()!)!
let DList = (0..<n).map { _ in readLine()!.split(separator: " ").compactMap { Int($0) } }

var maxCount = 0
var three = false
for i in 0..<n {
    if DList[i][0] == DList[i][1] {
        maxCount += 1
        if maxCount == 3 {
            three = true
            break
        }
    } else {
        maxCount = 0
    }
}
print(three ? "Yes" : "No")
