import java.util.Scanner;
class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		int[] arr1=new int[n];
		int count=0,flag=0;
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) 
		{
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		}
			
			
		
		if(flag==1)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	}

} import java.util.Scanner; Scanner 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[] arr1=new int[n];
		int count=0,flag=0;
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) 
		{
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		}
			
			
		
		if(flag==1)
		{
			System.out.println("Yes");
		}
		else
		{
			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[] arr1=new int[n];
		int count=0,flag=0;
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) 
		{
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		}
			
			
		
		if(flag==1)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	} main {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		int[] arr1=new int[n];
		int count=0,flag=0;
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) 
		{
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		}
			
			
		
		if(flag==1)
		{
			System.out.println("Yes");
		}
		else
		{
			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[] arr1=new int[n]; arr1 new int[n] n int count=0 count 0 flag=0; flag 0 for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		} {
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		} arr[i]=sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc arr1[i]=sc.nextInt() arr1[i] arr1 i sc.nextInt() sc.nextInt sc for(int i=0;i<n;i++) 
		{
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		} {
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		} if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			} arr[i]==arr1[i] arr[i] arr i arr1[i] arr1 i {
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			} count++ count if(count>=3)
				{
					flag=1;
					break;
					
				} count>=3 count 3 {
					flag=1;
					break;
					
				} flag=1 flag 1 break; {
				count=0;
			} count=0 count 0 if(flag==1)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		} flag==1 flag 1 {
			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
import java.util.Scanner;
class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] arr=new int[n];
		int[] arr1=new int[n];
		int count=0,flag=0;
		for(int i=0;i<n;i++)
		{
			arr[i]=sc.nextInt();
			arr1[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++) 
		{
				
			if(arr[i]==arr1[i])
			{
				count++;
				if(count>=3)
				{
					flag=1;
					break;
					
				}
			}
			else
			{
				count=0;
			}
			
		}
			
			
		
		if(flag==1)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	}

}
