import java.util.Scanner;
import java.util.Arrays;
/* 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
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		}
	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		}
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		}
	} main {
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		}
	} try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		} catch(Exception e) {
		} Exception e {
		} {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int t t n n i i a a b b k k m; m n=sc.nextInt() n sc.nextInt() sc.nextInt sc m=k=0 m k=0 k 0 for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        } i=0; i=0 i 0 i<n i n i++ i++ i {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        } {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        } a=sc.nextInt() a sc.nextInt() sc.nextInt sc b=sc.nextInt() b sc.nextInt() sc.nextInt sc if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             } a==b a b k++ k {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             } if(k>m)
		                 m=k; k>m k m m=k m k k=0 k 0 if(k>m)
		                 m=k; k>m k m m=k m k if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No"); m>=3 m 3 System.out.println("Yes") System.out.println System.out System System.out "Yes" 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) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		}
	}
} public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		}
	}
} Main
import java.util.Scanner;
import java.util.Arrays;
/* 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
	{
		try {
		    Scanner sc = new Scanner(System.in);
		    int t,n,i,a,b,k,m;
		    n=sc.nextInt();
		    
		        m=k=0;
		        for(i=0;i<n;i++)
		        {
		            a=sc.nextInt();
		            b=sc.nextInt();
		            if(a==b)
		             k++;
		             else
		             {
		          
		                 if(k>m)
		                 m=k;
		                 k=0;
		             }
		        }
		         if(k>m)
		                 m=k;
		        if(m>=3)
		        System.out.println("Yes");
		        else
		       System.out.println("No");
		    }
		 catch(Exception e) {
		}
	}
}
