import java.util.Scanner;

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