import java.util.*; 
import java.lang.*; 


public class Main{
    
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                
                int cnt = 0;
                for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
                
                System.out.println("No");

        }
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main{
    
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                
                int cnt = 0;
                for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
                
                System.out.println("No");

        }
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                
                int cnt = 0;
                for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
                
                System.out.println("No");

        } main {
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                
                int cnt = 0;
                for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
                
                System.out.println("No");

        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int cnt = 0; cnt 0 for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                } int i=0; int i=0; i 0 i<N i N i++ i++ i {
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                } {
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                } int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    } a==b a b {
                        cnt++;
                    } cnt++ cnt {
                        cnt=0;
                    } cnt=0 cnt 0 if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    } cnt==3 cnt 3 {
                        System.out.println("Yes");
                        System.exit(0);
                    } System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 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 scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                
                int cnt = 0;
                for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
                
                System.out.println("No");

        }
} public class Main{
    
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                
                int cnt = 0;
                for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
                
                System.out.println("No");

        }
} Main
import java.util.*; 
import java.lang.*; 


public class Main{
    
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int N = scan.nextInt();
                
                int cnt = 0;
                for(int i=0; i<N; i++){
                    int a = scan.nextInt();
                    int b = scan.nextInt();
                    
                    if(a==b){
                        cnt++;
                    }else{
                        cnt=0;
                    }
                    
                    if(cnt==3){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
                
                System.out.println("No");

        }
}