import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count=0;
        while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        }
        if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count=0;
        while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        }
        if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count=0;
        while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        }
        if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    } main {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count=0;
        while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        }
        if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int count=0; count 0 while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        } n!=0 n 0 {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        } int a = scn.nextInt(); a scn.nextInt() scn.nextInt scn int b = scn.nextInt(); b scn.nextInt() scn.nextInt scn if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            } a==b a b {
                count++;
            } count++ count if(count<3)
            {
                count=0;
            } count<3 count 3 {
                count=0;
            } count=0 count 0 n-- n if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        } count>=3 count 3 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } 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){
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count=0;
        while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        }
        if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count=0;
        while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        }
        if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int count=0;
        while(n!=0)
        {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a==b)
            {
                count++;
            }
            else if(count<3)
            {
                count=0;
            }
            n--;
        }
        if(count>=3)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
    }
}
