function MainB(input){
    const [N, ...Arr] = input.split('\n');
    let zoroCount = 0;
    const Darr = Arr.map(a => a.split(' '))
    for(let i=0; i< Darr.length; i++){
        if(Darr[i][0] == Darr[i][1]){
            zoroCount++;
        } else{
            zoroCount = 0;
        }
        if(zoroCount === 3) break; 
    }
    console.log(zoroCount === 3 ? "Yes" : "No");
}
MainB(require("fs").readFileSync("/dev/stdin", "utf8").trim());
