import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        int counter = 0;

        int[][] result = new int[n][2];
        for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        }

        for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        }

        if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        }

    }
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        int counter = 0;

        int[][] result = new int[n][2];
        for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        }

        for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        }

        if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        }

    }
} Main public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        int counter = 0;

        int[][] result = new int[n][2];
        for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        }

        for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        }

        if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        }

    } main {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        int counter = 0;

        int[][] result = new int[n][2];
        for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        }

        for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        }

        if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int counter = 0; counter 0 int[][] result = new int[n][2]; result new int[n][2] n 2 for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        } int i=0; int i=0; i 0 i < n i n i++ i++ i {
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        } {
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        } result[i][0] = sc.nextInt() result[i][0] result[i] result i 0 sc.nextInt() sc.nextInt sc result[i][1] = sc.nextInt() result[i][1] result[i] result i 1 sc.nextInt() sc.nextInt sc for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        } int i=0; int i=0; i 0 i< n i n i++ i++ i {
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        } {
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        } if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            } result[i][0] == result[i][1] result[i][0] result[i] result i 0 result[i][1] result[i] result i 1 {
                counter++;
                if(counter == 3){
                    break;
                }
            } counter++ counter if(counter == 3){
                    break;
                } counter == 3 counter 3 {
                    break;
                } break; {
                counter = 0;
            } counter = 0 counter 0 if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        } counter == 3 counter 3 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println(("No"));
        } System.out.println(("No")) System.out.println System.out System System.out ("No") String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        int counter = 0;

        int[][] result = new int[n][2];
        for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        }

        for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        }

        if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        }

    }
} public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        int counter = 0;

        int[][] result = new int[n][2];
        for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        }

        for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        }

        if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        }

    }
} Main
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        int counter = 0;

        int[][] result = new int[n][2];
        for(int i=0; i < n; i++){
            result[i][0] = sc.nextInt();
            result[i][1] = sc.nextInt();
        }

        for(int i=0; i< n; i++){
            if(result[i][0] == result[i][1]){
                counter++;
                if(counter == 3){
                    break;
                }
            }else {
                counter = 0;
            }
        }

        if(counter == 3){
            System.out.println("Yes");
        }else {
            System.out.println(("No"));
        }

    }
}
