import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N= scan.nextInt();
		int[][] darr = new int[N][2];
		int zorome = 0;
		for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		}
		System.out.println("No");
		return;
	}

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

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N= scan.nextInt();
		int[][] darr = new int[N][2];
		int zorome = 0;
		for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		}
		System.out.println("No");
		return;
	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N= scan.nextInt();
		int[][] darr = new int[N][2];
		int zorome = 0;
		for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		}
		System.out.println("No");
		return;
	} main {

		Scanner scan = new Scanner(System.in);
		int N= scan.nextInt();
		int[][] darr = new int[N][2];
		int zorome = 0;
		for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		}
		System.out.println("No");
		return;
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N= scan.nextInt(); N scan.nextInt() scan.nextInt scan int[][] darr = new int[N][2]; darr new int[N][2] N 2 int zorome = 0; zorome 0 for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		} {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		} darr[i][0] = Integer.parseInt(scan.next()) darr[i][0] darr[i] darr i 0 Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan darr[i][1] = Integer.parseInt(scan.next()) darr[i][1] darr[i] darr i 1 Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			} darr[i][0]==darr[i][1] darr[i][0] darr[i] darr i 0 darr[i][1] darr[i] darr i 1 {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} zorome++ zorome if (zorome ==3) {
					System.out.println("Yes");
					return;
				} zorome ==3 zorome 3 {
					System.out.println("Yes");
					return;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; {
				zorome = 0;
			} zorome = 0 zorome 0 System.out.println("No") System.out.println System.out System System.out "No" return; String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N= scan.nextInt();
		int[][] darr = new int[N][2];
		int zorome = 0;
		for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		}
		System.out.println("No");
		return;
	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N= scan.nextInt();
		int[][] darr = new int[N][2];
		int zorome = 0;
		for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		}
		System.out.println("No");
		return;
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N= scan.nextInt();
		int[][] darr = new int[N][2];
		int zorome = 0;
		for (int i = 0; i < N; i++) {
			darr[i][0] = Integer.parseInt(scan.next());
			darr[i][1] = Integer.parseInt(scan.next());
			if (darr[i][0]==darr[i][1]) {
				zorome++;
				if (zorome ==3) {
					System.out.println("Yes");
					return;
				}
			} else {
				zorome = 0;
			}
		}
		System.out.println("No");
		return;
	}

}
