import java.util.*;

public class Main{
	public static void main(String args[]){
	
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int is = 0;

		for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		}
		System.out.println((is == 3) ? "Yes" : "No");
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
	
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int is = 0;

		for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		}
		System.out.println((is == 3) ? "Yes" : "No");
	}
} Main public static void main(String args[]){
	
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int is = 0;

		for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		}
		System.out.println((is == 3) ? "Yes" : "No");
	} main {
	
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int is = 0;

		for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		}
		System.out.println((is == 3) ? "Yes" : "No");
	} Scanner ob = new Scanner(System.in); ob new Scanner(System.in) int N = ob.nextInt(); N ob.nextInt() ob.nextInt ob int is = 0; is 0 for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		} int roll = 1; int roll = 1; roll 1 roll <= N roll N roll++ roll++ roll {
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		} {
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		} int a = ob.nextInt(); a ob.nextInt() ob.nextInt ob int b = ob.nextInt(); b ob.nextInt() ob.nextInt ob if(a == b){
				++is;
			}else{
				is = 0;
			} a == b a b {
				++is;
			} ++is is {
				is = 0;
			} is = 0 is 0 if(is == 3){
				break;
			} is == 3 is 3 {
				break;
			} break; System.out.println((is == 3) ? "Yes" : "No") System.out.println System.out System System.out (is == 3) ? "Yes" : "No" (is == 3) is 3 "Yes" "No" String args[] args public class Main{
	public static void main(String args[]){
	
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int is = 0;

		for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		}
		System.out.println((is == 3) ? "Yes" : "No");
	}
} public class Main{
	public static void main(String args[]){
	
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int is = 0;

		for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		}
		System.out.println((is == 3) ? "Yes" : "No");
	}
} Main
import java.util.*;

public class Main{
	public static void main(String args[]){
	
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int is = 0;

		for(int roll = 1; roll <= N; roll++){
			
			int a = ob.nextInt();
			int b = ob.nextInt();

			if(a == b){
				++is;
			}else{
				is = 0;
			}

			if(is == 3){
				break;
			}
		}
		System.out.println((is == 3) ? "Yes" : "No");
	}
}
