import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int rolls = sc.nextInt();
		
		String output = "No";
		int doubleRollCount = 0;
		
		for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		}
		
		System.out.println(output);
		
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int rolls = sc.nextInt();
		
		String output = "No";
		int doubleRollCount = 0;
		
		for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		}
		
		System.out.println(output);
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int rolls = sc.nextInt();
		
		String output = "No";
		int doubleRollCount = 0;
		
		for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		}
		
		System.out.println(output);
		
	} main {
		Scanner sc = new Scanner(System.in);

		int rolls = sc.nextInt();
		
		String output = "No";
		int doubleRollCount = 0;
		
		for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		}
		
		System.out.println(output);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int rolls = sc.nextInt(); rolls sc.nextInt() sc.nextInt sc String output = "No"; output "No" int doubleRollCount = 0; doubleRollCount 0 for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		} int i = 0; int i = 0; i 0 i < rolls i rolls i++ i++ i {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		} {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		} int rollOne = sc.nextInt(); rollOne sc.nextInt() sc.nextInt sc int rollTwo = sc.nextInt(); rollTwo sc.nextInt() sc.nextInt sc if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			} rollOne == rollTwo rollOne rollTwo {
				doubleRollCount++;
			} doubleRollCount++ doubleRollCount {
				doubleRollCount = 0;
			} doubleRollCount = 0 doubleRollCount 0 if(doubleRollCount == 3) {
				output = "Yes";
			} doubleRollCount == 3 doubleRollCount 3 {
				output = "Yes";
			} output = "Yes" output "Yes" System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int rolls = sc.nextInt();
		
		String output = "No";
		int doubleRollCount = 0;
		
		for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		}
		
		System.out.println(output);
		
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int rolls = sc.nextInt();
		
		String output = "No";
		int doubleRollCount = 0;
		
		for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		}
		
		System.out.println(output);
		
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int rolls = sc.nextInt();
		
		String output = "No";
		int doubleRollCount = 0;
		
		for(int i = 0; i < rolls; i++) {
			int rollOne = sc.nextInt();
			int rollTwo = sc.nextInt();
			
			if(rollOne == rollTwo) {
				doubleRollCount++;
			}
			else {
				doubleRollCount = 0;
			}
			
			if(doubleRollCount == 3) {
				output = "Yes";
			}
		}
		
		System.out.println(output);
		
	}
}