import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int[][] nums = new int[input][2];
        for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        }

        scanner.close();

        int count = 0;
        for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }

        System.out.println("No");

    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int[][] nums = new int[input][2];
        for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        }

        scanner.close();

        int count = 0;
        for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }

        System.out.println("No");

    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int[][] nums = new int[input][2];
        for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        }

        scanner.close();

        int count = 0;
        for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }

        System.out.println("No");

    } main {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int[][] nums = new int[input][2];
        for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        }

        scanner.close();

        int count = 0;
        for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }

        System.out.println("No");

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int input = scanner.nextInt(); input scanner.nextInt() scanner.nextInt scanner int[][] nums = new int[input][2]; nums new int[input][2] input 2 for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        } int i = 0; int i = 0; i 0 i < input i input i++ i++ i {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        } {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        } for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            } int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
                nums[i][j] = scanner.nextInt();
            } {
                nums[i][j] = scanner.nextInt();
            } nums[i][j] = scanner.nextInt() nums[i][j] nums[i] nums i j scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner int count = 0; count 0 for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        } int[] a nums {
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        } {
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        } if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            } a[0]== a[1] a[0] a 0 a[1] a 1 {
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            } count++ count if(count ==3){
                    System.out.println("Yes");
                    return;
                } count ==3 count 3 {
                    System.out.println("Yes");
                    return;
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; {
                count = 0;
            } count = 0 count 0 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) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int[][] nums = new int[input][2];
        for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        }

        scanner.close();

        int count = 0;
        for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }

        System.out.println("No");

    }

} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int[][] nums = new int[input][2];
        for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        }

        scanner.close();

        int count = 0;
        for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }

        System.out.println("No");

    }

} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int input = scanner.nextInt();
        int[][] nums = new int[input][2];
        for (int i = 0; i < input; i++) {
            for (int j = 0; j < 2; j++) {
                nums[i][j] = scanner.nextInt();
            }
        }

        scanner.close();

        int count = 0;
        for(int[] a:nums){
            if(a[0]== a[1]){
                count++;
                if(count ==3){
                    System.out.println("Yes");
                    return;
                }
            }else{
                count = 0;
            }
        }

        System.out.println("No");

    }

}
