import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

// ABC179B
let n = readInt()
var dij: [[Int]] = []
for _ in 1...n {
    dij.append(readInts())
}
var count = 0
var result = "No"
for d in dij {
    if d[0] == d[1] {
        count += 1
    } else {
        count = 0
    }
    if count == 3 {
        result = "Yes"
        break
    }
}
print(result)
