import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] D1 = new int[N];
		int[] D2 = new int[N];
		int a = 0;
		
		for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		}
		
		if(!(a == 3)) {
			System.out.println("No");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] D1 = new int[N];
		int[] D2 = new int[N];
		int a = 0;
		
		for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		}
		
		if(!(a == 3)) {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] D1 = new int[N];
		int[] D2 = new int[N];
		int a = 0;
		
		for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		}
		
		if(!(a == 3)) {
			System.out.println("No");
		}
	} main {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] D1 = new int[N];
		int[] D2 = new int[N];
		int a = 0;
		
		for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		}
		
		if(!(a == 3)) {
			System.out.println("No");
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int[] D1 = new int[N]; D1 new int[N] N int[] D2 = new int[N]; D2 new int[N] N int a = 0; a 0 for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		} {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		} D1[i] = in.nextInt() D1[i] D1 i in.nextInt() in.nextInt in D2[i] = in.nextInt() D2[i] D2 i in.nextInt() in.nextInt in for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		} {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		} if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			} D1[i] == D2[i] D1[i] D1 i D2[i] D2 i {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			} a++ a if(a == 3) {
					System.out.println("Yes");
					break;
				} a == 3 a 3 {
					System.out.println("Yes");
					break;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" break; {
				a = 0;
			} a = 0 a 0 if(!(a == 3)) {
			System.out.println("No");
		} !(a == 3) (a == 3) a 3 {
			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) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] D1 = new int[N];
		int[] D2 = new int[N];
		int a = 0;
		
		for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		}
		
		if(!(a == 3)) {
			System.out.println("No");
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] D1 = new int[N];
		int[] D2 = new int[N];
		int a = 0;
		
		for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		}
		
		if(!(a == 3)) {
			System.out.println("No");
		}
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] D1 = new int[N];
		int[] D2 = new int[N];
		int a = 0;
		
		for(int i = 0; i < N; i++) {
			D1[i] = in.nextInt();
			D2[i] = in.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(D1[i] == D2[i]) {
				a++;
				if(a == 3) {
					System.out.println("Yes");
					break;
				}
			}else {
				a = 0;
			}
		}
		
		if(!(a == 3)) {
			System.out.println("No");
		}
	}
}
