let input = require('fs').readFileSync('/dev/stdin', 'utf8')
// let input = require('fs').readFileSync('./sample_b.txt', 'utf8')
.split(/\n/)
// .map(item => parseInt(item))
.slice(1,-1)

const sample = input.map(item=>item.split(" "))


let sum = 0
for( item of sample){
    if( item[0] === item[1] ){
        sum++
    }else{
        sum = 0
    }
    if(sum === 3){
        console.log("Yes")
        return
    }
}
console.log("No")