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

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

func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func mainB() {
    let N = readInt()
    let pairs = (0..<N).map { _ in readTwoInts() }

    var count = 0
    for pair in pairs {
        if pair.a == pair.b {
            count += 1
        } else {
            count = 0
        }

        if count == 3 {
            print("Yes")
            return
        }
    }

    print("No")
}
mainB()