import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				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 scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		}


	}




} Main public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		}


	} main {
		try(Scanner scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		}


	} try(Scanner scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		} {

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		} Scanner scan = new Scanner(System.in) Scanner scan = new Scanner(System.in) new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[][]D = new int[N][2]; D new int[N][2] N 2 int[]che = new int[N]; che new int[N] N int count = 0; count 0 int renzoku = 0; renzoku 0 for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			} {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			} D[i][0] = scan.nextInt() D[i][0] D[i] D i 0 scan.nextInt() scan.nextInt scan D[i][1] = scan.nextInt() D[i][1] D[i] D i 1 scan.nextInt() scan.nextInt scan if(D[i][0]==D[i][1]) {
					che[i]++;
				} D[i][0]==D[i][1] D[i][0] D[i] D i 0 D[i][1] D[i] D i 1 {
					che[i]++;
				} che[i]++ che[i] che i int ok = 0; ok 0 for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			} int i = 0; int i = 0; i 0 i<N-2 i N-2 N 2 i++ i++ i {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			} {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			} if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				} D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1] D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1] D[i][0]==D[i][1] D[i][0] D[i] D i 0 D[i][1] D[i] D i 1 D[i+1][0]==D[i+1][1] D[i+1][0] D[i+1] D i+1 i 1 0 D[i+1][1] D[i+1] D i+1 i 1 1 D[i+2][0]==D[i+2][1] D[i+2][0] D[i+2] D i+2 i 2 0 D[i+2][1] D[i+2] D i+2 i 2 1 {
					ok=1;
				} ok=1 ok 1 if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			} ok==1 ok 1 {
				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 scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		}


	}




} public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				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 scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int[][]D = new int[N][2];
			int[]che = new int[N];


			int count = 0;
			int renzoku = 0;
			for(int i = 0;i<N;i++) {
				D[i][0] = scan.nextInt();
				D[i][1] = scan.nextInt();

				if(D[i][0]==D[i][1]) {
					che[i]++;
				}
			}

			int ok = 0;

			for(int i = 0;i<N-2;i++) {
				if(D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1]) {
					ok=1;
				}
			}

			if(ok==1) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}




		}


	}




}
