import java.util.*;
import java.lang.*;
import java.io.*;
 class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc=new Scanner(System.in);
	   // BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    int t=1;
	   // t=sc.nextInt();
	    //int t=Integer.parseInt(br.readLine());
	    while(--t>=0){
	        int n=sc.nextInt();
	        int a[][]=new int[n][2];
	        for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        }
	        int k=0;
	        for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        }
	        if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No");
	     
	        
	    }
	    
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc=new Scanner(System.in);
	   // BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    int t=1;
	   // t=sc.nextInt();
	    //int t=Integer.parseInt(br.readLine());
	    while(--t>=0){
	        int n=sc.nextInt();
	        int a[][]=new int[n][2];
	        for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        }
	        int k=0;
	        for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        }
	        if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No");
	     
	        
	    }
	    
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc=new Scanner(System.in);
	   // BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    int t=1;
	   // t=sc.nextInt();
	    //int t=Integer.parseInt(br.readLine());
	    while(--t>=0){
	        int n=sc.nextInt();
	        int a[][]=new int[n][2];
	        for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        }
	        int k=0;
	        for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        }
	        if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No");
	     
	        
	    }
	    
	} main {
	    Scanner sc=new Scanner(System.in);
	   // BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    int t=1;
	   // t=sc.nextInt();
	    //int t=Integer.parseInt(br.readLine());
	    while(--t>=0){
	        int n=sc.nextInt();
	        int a[][]=new int[n][2];
	        for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        }
	        int k=0;
	        for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        }
	        if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No");
	     
	        
	    }
	    
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int t=1; t 1 while(--t>=0){
	        int n=sc.nextInt();
	        int a[][]=new int[n][2];
	        for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        }
	        int k=0;
	        for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        }
	        if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No");
	     
	        
	    } --t>=0 --t t 0 {
	        int n=sc.nextInt();
	        int a[][]=new int[n][2];
	        for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        }
	        int k=0;
	        for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        }
	        if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No");
	     
	        
	    } int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int a[][]=new int[n][2]; a new int[n][2] n 2 for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        } {
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        } a[i][0]=sc.nextInt() a[i][0] a[i] a i 0 sc.nextInt() sc.nextInt sc a[i][1]=sc.nextInt() a[i][1] a[i] a i 1 sc.nextInt() sc.nextInt sc int k=0; k 0 for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        } int i=0; int i=0; i 0 i<n-2 i n-2 n 2 i++ i++ i {
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        } {
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        } if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            } a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1] a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1] a[i][0]==a[i][1] a[i][0] a[i] a i 0 a[i][1] a[i] a i 1 a[i+1][0]==a[i+1][1] a[i+1][0] a[i+1] a i+1 i 1 0 a[i+1][1] a[i+1] a i+1 i 1 1 a[i+2][0]==a[i+2][1] a[i+2][0] a[i+2] a i+2 i 2 0 a[i+2][1] a[i+2] a i+2 i 2 1 {
	                k=1;
	            } k=1 k 1 if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No"); k==1 k 1 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
import java.util.*;
import java.lang.*;
import java.io.*;
 class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc=new Scanner(System.in);
	   // BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    int t=1;
	   // t=sc.nextInt();
	    //int t=Integer.parseInt(br.readLine());
	    while(--t>=0){
	        int n=sc.nextInt();
	        int a[][]=new int[n][2];
	        for(int i=0;i<n;i++){
	            a[i][0]=sc.nextInt();
	            a[i][1]=sc.nextInt();
	        }
	        int k=0;
	        for(int i=0;i<n-2;i++){
	            if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1]){
	                k=1;
	            }
	            
	        }
	        if(k==1)
	        System.out.println("Yes");
	        else
	        System.out.println("No");
	     
	        
	    }
	    
	}
}