function main(input) {
  const n = parseInt(input[0]);
  let judge = false;
  let stack = 0;
  for(let i=0;i<n;i++){
    const inputs = input[1+i].trim().split(" ").map(i => parseInt(i));
    
    if(inputs[0]===inputs[1]){
      stack++;
    }else{
      stack=0;
    }
    if(stack>=3){
      judge=true;
      break;
    }
  }
  console.log(judge?"Yes":"No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));