import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}

} Main public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	} main {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	} try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		} {
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count = 0; count 0 int[][] ans = new int[n][n]; ans new int[n][n] n n for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			} {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			} for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				} int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
					ans[i][j] = sc.nextInt();
				} {
					ans[i][j] = sc.nextInt();
				} ans[i][j] = sc.nextInt() ans[i][j] ans[i] ans i j sc.nextInt() sc.nextInt sc if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				} ans[i][0] == ans[i][1] ans[i][0] ans[i] ans i 0 ans[i][1] ans[i] ans i 1 {
					count++;
					if(count >= 3) {
						break;
					}
				} count++ count if(count >= 3) {
						break;
					} count >= 3 count 3 {
						break;
					} break; {
					count = 0;
				} count = 0 count 0 if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			} count >= 3 count 3 {
				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" String[] args args public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}

} public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}

} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int n = sc.nextInt();
			int count = 0;
			int[][] ans = new int[n][n];
			for(int i = 0;i < n;i++) {
				for(int j = 0;j < 2;j++) {
					ans[i][j] = sc.nextInt();
				}
				if(ans[i][0] == ans[i][1]) {
					count++;
					if(count >= 3) {
						break;
					}
				}
				else {
					count = 0;
				}
			}
			if(count >= 3) {
				System.out.println("Yes");
			}
			else {
				System.out.println("No");
			}
		}
	}

}
