import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)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 times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)System.out.println("Yes");
      else System.out.println("No");
	}
	
	
} Main public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)System.out.println("Yes");
      else System.out.println("No");
	} main {
		Scanner sc=new Scanner(System.in);
		int times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)System.out.println("Yes");
      else System.out.println("No");
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int times=sc.nextInt(); times sc.nextInt() sc.nextInt sc Integer[] data1=new Integer[times]; data1 new Integer[times] times Integer[] data2=new Integer[times]; data2 new Integer[times] times boolean one=false; one false boolean two=false; two false boolean now=false; now false boolean result=false; result false for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        } int i=0; int i=0; i 0 i<times i times i++ i++ i {
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        } {
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        } data1[i]=sc.nextInt() data1[i] data1 i sc.nextInt() sc.nextInt sc data2[i]=sc.nextInt() data2[i] data2 i sc.nextInt() sc.nextInt sc for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        } int i=0; int i=0; i 0 i<times i times i++ i++ i {
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        } {
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        } now=(data1[i]==data2[i]) now (data1[i]==data2[i]) data1[i] data1 i data2[i] data2 i if(one&&two&&now){
            result=true;
			break;
          } one&&two&&now one&&two&&now one two now {
            result=true;
			break;
          } result=true result true break; two=one two one one=now one now if(result)System.out.println("Yes");
      else System.out.println("No"); result 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 public class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)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 times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)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 times=sc.nextInt();
        Integer[] data1=new Integer[times];
        Integer[] data2=new Integer[times];
        boolean one=false;
        boolean two=false;
      	boolean now=false;
      	boolean result=false;
        for(int i=0;i<times;i++){
          data1[i]=sc.nextInt();
          data2[i]=sc.nextInt();
        }
        for(int i=0;i<times;i++){
          now=(data1[i]==data2[i]);
          if(one&&two&&now){
            result=true;
			break;
          }
	      two=one;
	      one=now;
        }

      if(result)System.out.println("Yes");
      else System.out.println("No");
	}
	
	
}