func main() {
    let n = Int(readLine()!)!
    
    var streak = 0
    for _ in 0..<n {
        let inputs = readLine()!
            .split(separator: " ")
            .compactMap { Int($0)! }
        if inputs[0] == inputs[1] {
            streak += 1
        } else {
            streak = 0
        }
        if streak >= 3 {
            print("Yes")
            return
        }
    }
    print("No")
}

main()
