import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		
		boolean ans = false;
		for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		
		boolean ans = false;
		for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		
		boolean ans = false;
		for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		
		boolean ans = false;
		for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array1 = new int[n]; array1 new int[n] n int[] array2 = new int[n]; array2 new int[n] n for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		} {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		} array1[i] = sc.nextInt() array1[i] array1 i sc.nextInt() sc.nextInt sc array2[i] = sc.nextInt() array2[i] array2 i sc.nextInt() sc.nextInt sc boolean ans = false; ans false for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		} int i = 0; int i = 0; i 0 i < n - 2 i n - 2 n 2 i++ i++ i {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		} {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		} if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			} array1[i] == array2[i] array1[i] array1 i array2[i] array2 i {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			} if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				} array1[i+1] == array2[i + 1] array1[i+1] array1 i+1 i 1 array2[i + 1] array2 i + 1 i 1 {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				} if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					} array1[i + 2] == array2[i + 2] array1[i + 2] array1 i + 2 i 2 array2[i + 2] array2 i + 2 i 2 {
						ans = true;
						break;
					} ans = true ans true break; if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} ans {
			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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		
		boolean ans = false;
		for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		
		boolean ans = false;
		for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i = 0; i < n; i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		
		boolean ans = false;
		for(int i = 0; i < n - 2; i++) {
			if(array1[i] == array2[i]) {
				if(array1[i+1] == array2[i + 1]) {
					if(array1[i + 2] == array2[i + 2]) {
						ans = true;
						break;
					}
				}
			}
		}
		
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		sc.close();
	}
}
