import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
	    String s = "No";
        int count = 0;
        for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            }		       
		System.out.println(s);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
	    String s = "No";
        int count = 0;
        for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            }		       
		System.out.println(s);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
	    String s = "No";
        int count = 0;
        for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            }		       
		System.out.println(s);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
	    String s = "No";
        int count = 0;
        for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            }		       
		System.out.println(s);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc String s = "No"; s "No" int count = 0; count 0 for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            } int i=0; int i=0; i 0 i<a i a i++ i++ i {int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            } {int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            } int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc if(b==c){count++;}
                             else{count=0;} b==c b c {count++;} count++ count {count=0;} count=0 count 0 if(count>=3){s="Yes";break;} count>=3 count 3 {s="Yes";break;} s="Yes" s "Yes" break; System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
	    String s = "No";
        int count = 0;
        for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            }		       
		System.out.println(s);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
	    String s = "No";
        int count = 0;
        for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            }		       
		System.out.println(s);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
	    String s = "No";
        int count = 0;
        for(int i=0;i<a;i++){int b = sc.nextInt();
                             int c = sc.nextInt();
                             if(b==c){count++;}
                             else{count=0;}
                             if(count>=3){s="Yes";break;}
                            }		       
		System.out.println(s);
	}
}