import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int c=0;
        int f=0;
        for (int i=0;i<n;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        }
        if(f==0)
            System.out.print("No");
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int c=0;
        int f=0;
        for (int i=0;i<n;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        }
        if(f==0)
            System.out.print("No");
    }
} Main public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int c=0;
        int f=0;
        for (int i=0;i<n;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        }
        if(f==0)
            System.out.print("No");
    } main {
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int c=0;
        int f=0;
        for (int i=0;i<n;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        }
        if(f==0)
            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 c=0; c 0 int f=0; f 0 for (int i=0;i<n;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        } 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){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        } {
            int a=sc.nextInt();
            int b=sc.nextInt();
            if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        } int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0; a==b a b {
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            } c++ c if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                } c==3 c 3 {
                    f=1;
                    System.out.print("Yes");
                    break;
                } f=1 f 1 System.out.print("Yes") System.out.print System.out System System.out "Yes" break; c=0 c 0 if(f==0)
            System.out.print("No"); f==0 f 0 System.out.print("No") System.out.print System.out System System.out "No" String[] args args
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n=sc.nextInt();
        int c=0;
        int f=0;
        for (int i=0;i<n;i++){
            int a=sc.nextInt();
            int b=sc.nextInt();
            if (a==b){
                c++;
                if (c==3){
                    f=1;
                    System.out.print("Yes");
                    break;
                }
            }
            else
                c=0;
        }
        if(f==0)
            System.out.print("No");
    }
}