function Main(input) {
	input = input.split('\n')
  	length = Number(input[0])
  	let count = 0
  	
  	for(let i=1;i<=length;i++){
    	let temp = input[i].split(' ').map(e=>Number(e))
        if(temp[0] === temp[1]){
        	++count
        }else{
         	count = 0 
        }
      
      	if(count === 3){
        	console.log('Yes')
          	break
        }
    }
  	if(count !== 3){console.log('No')}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))