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