import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		int N = scanner.nextInt();

		int streak = 0;
		boolean judge = false;
		for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		}

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

		scanner.close();
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		int N = scanner.nextInt();

		int streak = 0;
		boolean judge = false;
		for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		}

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

		scanner.close();
	}

} Main public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		int N = scanner.nextInt();

		int streak = 0;
		boolean judge = false;
		for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		}

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

		scanner.close();
	} main {
		Scanner scanner =new Scanner(System.in);
		int N = scanner.nextInt();

		int streak = 0;
		boolean judge = false;
		for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		}

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

		scanner.close();
	} Scanner scanner =new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int streak = 0; streak 0 boolean judge = false; judge false for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		} {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		} int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner if (A == B) {
				streak++;
			}else{
				streak = 0;
			} A == B A B {
				streak++;
			} streak++ streak {
				streak = 0;
			} streak = 0 streak 0 if (streak >= 3) {
				judge = true;
			} streak >= 3 streak 3 {
				judge = true;
			} judge = true judge true if (judge) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} judge {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		int N = scanner.nextInt();

		int streak = 0;
		boolean judge = false;
		for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		}

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

		scanner.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		int N = scanner.nextInt();

		int streak = 0;
		boolean judge = false;
		for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		}

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

		scanner.close();
	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scanner =new Scanner(System.in);
		int N = scanner.nextInt();

		int streak = 0;
		boolean judge = false;
		for (int i = 0; i < N; i++) {
			int A = scanner.nextInt();
			int B = scanner.nextInt();
			if (A == B) {
				streak++;
			}else{
				streak = 0;
			}
			if (streak >= 3) {
				judge = true;
			}
		}

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

		scanner.close();
	}

}
