process.stdin.resume()
process.stdin.setEncoding('utf8')
var g_input = ''
process.stdin.on('data', function(chunk) {
    g_input += chunk
})
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/))
})
function main(input){
  const n = input.shift()
  let c = 0
  for(let i of input){
    i = i.split(' ')
    const d1 = i[0]
    const d2 = i[1]
    if(d1 == d2){
      
      c++
      if(c==3){
        console.log('Yes')
        return
      }
    }else{
      c = 0
    }
  }
  console.log('No')
}