function main(input) {
  	const results = input.split('\n').slice(1)
	let doubletNum = 0

    const result = results.some(res => {
    	if(res[0] === res[2]) doubletNum+=1
      	return doubletNum >= 3
    })
	console.log(result ? 'Yes' : 'No')
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
