import java.util.*;
public class Main{
	public static void main(String[]args){
      Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
		int flag=0;
		boolean done=false;
		while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		}
		if(!done)
		System.out.println("No");
		else
		System.out.println("Yes");
    }	
  
} import java.util.*; util.* java public class Main{
	public static void main(String[]args){
      Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
		int flag=0;
		boolean done=false;
		while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		}
		if(!done)
		System.out.println("No");
		else
		System.out.println("Yes");
    }	
  
} Main public static void main(String[]args){
      Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
		int flag=0;
		boolean done=false;
		while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		}
		if(!done)
		System.out.println("No");
		else
		System.out.println("Yes");
    } main {
      Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
		int flag=0;
		boolean done=false;
		while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		}
		if(!done)
		System.out.println("No");
		else
		System.out.println("Yes");
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int n=scan.nextInt(); n scan.nextInt() scan.nextInt scan int flag=0; flag 0 boolean done=false; done false while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		} n--!=0 n-- n 0 {
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		} int a=scan.nextInt(); a scan.nextInt() scan.nextInt scan int b=scan.nextInt(); b scan.nextInt() scan.nextInt scan if(a==b)flag++; a==b a b flag++ flag if(flag==3){
				done=true;
			} flag==3 flag 3 {
				done=true;
			} done=true done true if(a!=b)flag=0; a!=b a b flag=0 flag 0 if(!done)
		System.out.println("No");
		else
		System.out.println("Yes"); !done done System.out.println("No") System.out.println System.out System System.out "No" System.out.println("Yes") System.out.println System.out System System.out "Yes" String[]args args public class Main{
	public static void main(String[]args){
      Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
		int flag=0;
		boolean done=false;
		while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		}
		if(!done)
		System.out.println("No");
		else
		System.out.println("Yes");
    }	
  
} public class Main{
	public static void main(String[]args){
      Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
		int flag=0;
		boolean done=false;
		while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		}
		if(!done)
		System.out.println("No");
		else
		System.out.println("Yes");
    }	
  
} Main
import java.util.*;
public class Main{
	public static void main(String[]args){
      Scanner scan=new Scanner(System.in);
    	int n=scan.nextInt();
		int flag=0;
		boolean done=false;
		while(n--!=0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			if(a==b)flag++;
			if(flag==3){
				done=true;
			}
			if(a!=b)flag=0;
		}
		if(!done)
		System.out.println("No");
		else
		System.out.println("Yes");
    }	
  
}