function main(lines) {
  const N = n();

  for (let i = 1, cnt = 0; i <= N; i++) {
    const [d1, d2] = na();
    if (d1 === d2) cnt++;
    else cnt = 0;
    if (cnt === 3) return 'Yes';
  }
  
  return 'No';
}



const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");

let lineCount = 0;
const s = () => lines[lineCount++];
const n = () => Number(s());
const b = () => BigInt(s());
const sa = () => s().split(' ');
const na = () => sa().map(Number);
const ba = () => sa().map(BigInt);
const getLines = (n) => lines.slice(lineCount, lineCount += n);

const ans = main(lines);
console.log( ans );