import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    void run(String[] args){
        Scanner scan=new Scanner(System.in);
        Integer count=scan.nextInt();
        Integer one;
        Integer two;
        Integer i;
        ArrayList<Integer>ones=new ArrayList<>();
        ArrayList<Integer>twos=new ArrayList<>();
        ArrayList<Integer>counts=new ArrayList<>();
        for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        }
        for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        }
        print(count,counts);
    }
    Integer print(Integer count,ArrayList<Integer>counts){
        Integer i;
        for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        }
        System.out.println("No");
        return 0;
    }
    public static void main(String args[]){
        Main printer = new Main();
        printer.run(args);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
    void run(String[] args){
        Scanner scan=new Scanner(System.in);
        Integer count=scan.nextInt();
        Integer one;
        Integer two;
        Integer i;
        ArrayList<Integer>ones=new ArrayList<>();
        ArrayList<Integer>twos=new ArrayList<>();
        ArrayList<Integer>counts=new ArrayList<>();
        for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        }
        for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        }
        print(count,counts);
    }
    Integer print(Integer count,ArrayList<Integer>counts){
        Integer i;
        for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        }
        System.out.println("No");
        return 0;
    }
    public static void main(String args[]){
        Main printer = new Main();
        printer.run(args);
    }
} Main void run(String[] args){
        Scanner scan=new Scanner(System.in);
        Integer count=scan.nextInt();
        Integer one;
        Integer two;
        Integer i;
        ArrayList<Integer>ones=new ArrayList<>();
        ArrayList<Integer>twos=new ArrayList<>();
        ArrayList<Integer>counts=new ArrayList<>();
        for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        }
        for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        }
        print(count,counts);
    } run {
        Scanner scan=new Scanner(System.in);
        Integer count=scan.nextInt();
        Integer one;
        Integer two;
        Integer i;
        ArrayList<Integer>ones=new ArrayList<>();
        ArrayList<Integer>twos=new ArrayList<>();
        ArrayList<Integer>counts=new ArrayList<>();
        for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        }
        for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        }
        print(count,counts);
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) Integer count=scan.nextInt(); count scan.nextInt() scan.nextInt scan Integer one; one Integer two; two Integer i; i ArrayList<Integer>ones=new ArrayList<>(); ones new ArrayList<>() ArrayList<Integer>twos=new ArrayList<>(); twos new ArrayList<>() ArrayList<Integer>counts=new ArrayList<>(); counts new ArrayList<>() for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        } i=0; i=0 i 0 i<count i count i++ i++ i {
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        } {
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        } one=scan.nextInt() one scan.nextInt() scan.nextInt scan two=scan.nextInt() two scan.nextInt() scan.nextInt scan ones.add(one) ones.add ones one twos.add(two) twos.add twos two for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        } i=0; i=0 i 0 i<count i count i++ i++ i {
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        } {
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        } if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            } ones.get(i)==twos.get(i) ones.get(i) ones.get ones i twos.get(i) twos.get twos i {
                counts.add(1);
            } counts.add(1) counts.add counts 1 {
                counts.add(0);
            } counts.add(0) counts.add counts 0 print(count,counts) print count counts String[] args args Integer print(Integer count,ArrayList<Integer>counts){
        Integer i;
        for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        }
        System.out.println("No");
        return 0;
    } print {
        Integer i;
        for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        }
        System.out.println("No");
        return 0;
    } Integer i; i for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        } i=0; i=0 i 0 i<count-2 i count-2 count 2 i++ i++ i {
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        } {
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        } if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            } (1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2)) (1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2)) (1==counts.get(i)) 1 counts.get(i) counts.get counts i (counts.get(i)==counts.get(i+1)) counts.get(i) counts.get counts i counts.get(i+1) counts.get counts i+1 i 1 (counts.get(i+1)==counts.get(i+2)) counts.get(i+1) counts.get counts i+1 i 1 counts.get(i+2) counts.get counts i+2 i 2 {
                System.out.println("Yes");
                return 0;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return 0; 0 System.out.println("No") System.out.println System.out System System.out "No" return 0; 0 Integer count count ArrayList<Integer>counts counts public static void main(String args[]){
        Main printer = new Main();
        printer.run(args);
    } main {
        Main printer = new Main();
        printer.run(args);
    } Main printer = new Main(); printer new Main() printer.run(args) printer.run printer args String args[] args public class Main {
    void run(String[] args){
        Scanner scan=new Scanner(System.in);
        Integer count=scan.nextInt();
        Integer one;
        Integer two;
        Integer i;
        ArrayList<Integer>ones=new ArrayList<>();
        ArrayList<Integer>twos=new ArrayList<>();
        ArrayList<Integer>counts=new ArrayList<>();
        for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        }
        for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        }
        print(count,counts);
    }
    Integer print(Integer count,ArrayList<Integer>counts){
        Integer i;
        for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        }
        System.out.println("No");
        return 0;
    }
    public static void main(String args[]){
        Main printer = new Main();
        printer.run(args);
    }
} public class Main {
    void run(String[] args){
        Scanner scan=new Scanner(System.in);
        Integer count=scan.nextInt();
        Integer one;
        Integer two;
        Integer i;
        ArrayList<Integer>ones=new ArrayList<>();
        ArrayList<Integer>twos=new ArrayList<>();
        ArrayList<Integer>counts=new ArrayList<>();
        for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        }
        for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        }
        print(count,counts);
    }
    Integer print(Integer count,ArrayList<Integer>counts){
        Integer i;
        for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        }
        System.out.println("No");
        return 0;
    }
    public static void main(String args[]){
        Main printer = new Main();
        printer.run(args);
    }
} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    void run(String[] args){
        Scanner scan=new Scanner(System.in);
        Integer count=scan.nextInt();
        Integer one;
        Integer two;
        Integer i;
        ArrayList<Integer>ones=new ArrayList<>();
        ArrayList<Integer>twos=new ArrayList<>();
        ArrayList<Integer>counts=new ArrayList<>();
        for(i=0;i<count;i++){
            one=scan.nextInt();
            two=scan.nextInt();
            ones.add(one);
            twos.add(two);
        }
        for(i=0;i<count;i++){
            if(ones.get(i)==twos.get(i)){
                counts.add(1);
            }
            else{
                counts.add(0);
            }
        }
        print(count,counts);
    }
    Integer print(Integer count,ArrayList<Integer>counts){
        Integer i;
        for(i=0;i<count-2;i++){
            if((1==counts.get(i))&&(counts.get(i)==counts.get(i+1))&&(counts.get(i+1)==counts.get(i+2))){
                System.out.println("Yes");
                return 0;
            }
        }
        System.out.println("No");
        return 0;
    }
    public static void main(String args[]){
        Main printer = new Main();
        printer.run(args);
    }
}