const main = stdin => {
  const input = stdin.trim().split('\n')
  const N = parseInt(input[0])

  let zorome = 0
  for (let i = 0; i < N; i++) {
    const [one, two] = input[i + 1].split(' ').map(x => parseInt(x))
    if (one === two) {
      zorome++
    }
    if (zorome === 3) {
      console.log('Yes')
      return
    }
    if (zorome > 0 && one !== two) {
      zorome = 0
    }
  }
  console.log('No')

}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
