import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int zoro_cnt = 0;

		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		}

		if (zoro_cnt >= 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){

		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int zoro_cnt = 0;

		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		}

		if (zoro_cnt >= 3) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int zoro_cnt = 0;

		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		}

		if (zoro_cnt >= 3) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {

		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int zoro_cnt = 0;

		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		}

		if (zoro_cnt >= 3) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int zoro_cnt = 0; zoro_cnt 0 for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		} {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		} int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			} b == c b c {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} zoro_cnt++ zoro_cnt if (zoro_cnt >= 3) {
					break;
				} zoro_cnt >= 3 zoro_cnt 3 {
					break;
				} break; {
				zoro_cnt = 0;
			} zoro_cnt = 0 zoro_cnt 0 if (zoro_cnt >= 3) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} zoro_cnt >= 3 zoro_cnt 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){

		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int zoro_cnt = 0;

		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		}

		if (zoro_cnt >= 3) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int zoro_cnt = 0;

		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		}

		if (zoro_cnt >= 3) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		// 整数の入力
		int a = sc.nextInt();
		int zoro_cnt = 0;

		for (int i = 0; i < a; i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			if (b == c) {
				zoro_cnt++;
				if (zoro_cnt >= 3) {
					break;
				}
			} else {
				zoro_cnt = 0;
			}
		}

		if (zoro_cnt >= 3) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}