import java.util.*;

public class Main {
    

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();int c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    
    }
} import java.util.*; util.* java public class Main {
    

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();int c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            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 c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    
    } main {
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();int c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            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 c=0 c 0 i=0; i 0 boolean flag=false; flag false for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        } int x=1; int x=1; x 1 x<=N x N ++x ++x x {
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        } {
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        } int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            } b-a==0 b-a b a 0 {
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            } if(i==x || i+1==x){
                    c++;i=x;
                    } i==x || i+1==x i==x i x i+1==x i+1 i 1 x {
                    c++;i=x;
                    } c++ c i=x i x {
                i=x;c=0;
            } i=x i x c=0 c 0 if(c==3){
                flag=true;
                break;
            } c==3 c 3 {
                flag=true;
                break;
            } flag=true flag true break; if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        } flag {
            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 public class Main {
    

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();int c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    
    }
} public class Main {
    

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();int c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    
    }
} Main
import java.util.*;

public class Main {
    

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
       
        int N = sc.nextInt();int c=0,i=0;boolean flag=false;
        for(int x=1;x<=N;++x){
            int a=sc.nextInt();
            int b=sc.nextInt();//String s1="",s2="";
            
            if(b-a==0){
                if(i==x || i+1==x){
                    c++;i=x;
                    }
                
            }
            else{
                i=x;c=0;
            }
            if(c==3){
                flag=true;
                break;
            }
        }
            if(flag){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        
    
    }
}