import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    } main {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int count = 0; count 0 boolean flg = false; flg false for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if (a == b){
                count++;
            } else {
                count = 0;
            } a == b a b {
                count++;
            } count++ count {
                count = 0;
            } count = 0 count 0 if (count >= 3) {
                flg = true;
                break;
            } count >= 3 count 3 {
                flg = true;
                break;
            } flg = true flg true break; if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        } flg == true flg true {
            System.out.print("Yes");
        } System.out.print("Yes") System.out.print System.out System System.out "Yes" {
            System.out.print("No");
        } System.out.print("No") System.out.print System.out System System.out "No" String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean flg = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if (a == b){
                count++;
            } else {
                count = 0;
            } 
            if (count >= 3) {
                flg = true;
                break;
            }
        } 
        if (flg == true) {
            System.out.print("Yes");
        } else {
            System.out.print("No");
        }
    }
}
