/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    }
}
     import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    }
} Main public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    } main {
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    } try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        } Exception e {
            System.err.println("ERROR");
            return;
        } System.err.println("ERROR") System.err.println System.err System System.err "ERROR" return; {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter ot=new PrintWriter(System.out); ot new PrintWriter(System.out) int n=Integer.parseInt(br.readLine().trim()); n Integer.parseInt(br.readLine().trim()) Integer.parseInt Integer br.readLine().trim() br.readLine().trim br.readLine() br.readLine br int total=0; total 0 int a[][]=new int[n][2]; a new int[n][2] n 2 for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            } int i=0; int i=0; i 0 i<n i n i++ i++ i {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            } {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            } String s[]=br.readLine().trim().split(" "); s br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                } int j=0; int j=0; j 0 j<2 j 2 j++ j++ j {
                    a[i][j]=Integer.parseInt(s[j]);
                } {
                    a[i][j]=Integer.parseInt(s[j]);
                } a[i][j]=Integer.parseInt(s[j]) a[i][j] a[i] a i j Integer.parseInt(s[j]) Integer.parseInt Integer s[j] s j boolean bool=false; bool false for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            } int i=0; int i=0; i 0 i<n-2 i n-2 n 2 i++ i++ i {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            } {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            } if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                } a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1] a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1] a[i][0]==a[i][1] a[i][0] a[i] a i 0 a[i][1] a[i] a i 1 a[i+1][0]==a[i+1][1] a[i+1][0] a[i+1] a i+1 i 1 0 a[i+1][1] a[i+1] a i+1 i 1 1 a[i+2][0]==a[i+2][1] a[i+2][0] a[i+2] a i+2 i 2 0 a[i+2][1] a[i+2] a i+2 i 2 1 {
                    bool=true;
                    break;
                } bool=true bool true break; if(bool)
            ot.println("Yes");
            else
            ot.println("No"); bool ot.println("Yes") ot.println ot "Yes" ot.println("No") ot.println ot "No" br.close() br.close br ot.close() ot.close ot String[] args args public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    }
} public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    }
} Main
/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try{
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            PrintWriter ot=new PrintWriter(System.out);
            int n=Integer.parseInt(br.readLine().trim());
            
            int total=0;
            int a[][]=new int[n][2];
            for(int i=0;i<n;i++)
            {
                String s[]=br.readLine().trim().split(" ");
                for(int j=0;j<2;j++)
                {
                    a[i][j]=Integer.parseInt(s[j]);
                }
            }
            boolean bool=false;
            for(int i=0;i<n-2;i++)
            {
                if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
                {
                    bool=true;
                    break;
                }
            }
            if(bool)
            ot.println("Yes");
            else
            ot.println("No");
            // while(t-->0)
            // {
                
            // }
            br.close();
            ot.close();
                        
        } catch(Exception e){
            System.err.println("ERROR");
            return;
        }
    }
}
    