import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] d = new int[n][2];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] d = new int[n][2];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }

} Main public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] d = new int[n][2];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    } main {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] d = new int[n][2];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    } @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[][] d = new int[n][2]; d new int[n][2] n 2 for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        } {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        } for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            } int j = 0 ; int j = 0 ; j 0 j < 2 j 2 j++ j++ j {
                d[i][j] = sc.nextInt();
            } {
                d[i][j] = sc.nextInt();
            } d[i][j] = sc.nextInt() d[i][j] d[i] d i j sc.nextInt() sc.nextInt sc int c = 0; c 0 for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        } {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        } if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            } d[i][0] == d[i][1] d[i][0] d[i] d i 0 d[i][1] d[i] d i 1 {
                c++;
            } c++ c {
                c = 0;
            } c = 0 c 0 if (c >= 3) {
                System.out.println("Yes");
                return;
            } c >= 3 c 3 {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] d = new int[n][2];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }

} public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] d = new int[n][2];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] d = new int[n][2];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 2 ; j++) {
                d[i][j] = sc.nextInt();
            }
        }
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            if (d[i][0] == d[i][1]) {
                c++;
            } else {
                c = 0;
            }
            if (c >= 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");

    }

}
