import java.util.*;
import java.io.*;
import java.lang.*;

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

        int n = sc.nextInt();
        int ans = 0;
        String p = "No";
        for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        }
        System.out.println(p);
    }
} import java.util.*; util.* java import java.io.*; io.* java import java.lang.*; lang.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        String p = "No";
        for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        }
        System.out.println(p);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        String p = "No";
        for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        }
        System.out.println(p);
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        String p = "No";
        for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        }
        System.out.println(p);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 0; ans 0 String p = "No"; p "No" for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                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)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        } {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if (a==b)
                ans++;
            else
                ans = 0; a==b a b ans++ ans ans = 0 ans 0 if (ans==3){
                p = "Yes";
                break;
            } ans==3 ans 3 {
                p = "Yes";
                break;
            } p = "Yes" p "Yes" break; System.out.println(p) System.out.println System.out System System.out p String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        String p = "No";
        for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        }
        System.out.println(p);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        String p = "No";
        for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        }
        System.out.println(p);
    }
} Main
import java.util.*;
import java.io.*;
import java.lang.*;

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

        int n = sc.nextInt();
        int ans = 0;
        String p = "No";
        for (int i = 0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (a==b)
                ans++;
            else
                ans = 0;
            if (ans==3){
                p = "Yes";
                break;
            }
        }
        System.out.println(p);
    }
}