import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		}
		String ans = flg ? "Yes" : "No";
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		}
		String ans = flg ? "Yes" : "No";
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		}
		String ans = flg ? "Yes" : "No";
		System.out.println(ans);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		}
		String ans = flg ? "Yes" : "No";
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc boolean flg = false; flg false int cnt = 0; cnt 0 for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		} {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		} sc.nextLine() sc.nextLine sc int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			} a == b a b {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} cnt++ cnt if (cnt == 3) {
					flg = true;
				} cnt == 3 cnt 3 {
					flg = true;
				} flg = true flg true {
				cnt = 0;
			} cnt = 0 cnt 0 String ans = flg ? "Yes" : "No"; ans flg ? "Yes" : "No" flg "Yes" "No" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		}
		String ans = flg ? "Yes" : "No";
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		}
		String ans = flg ? "Yes" : "No";
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flg = false;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			sc.nextLine();
			int a = sc.nextInt();
			int b = sc.nextInt();
			if (a == b) {
				cnt++;
				if (cnt == 3) {
					flg = true;
				}
			} else {
				cnt = 0;
			}
		}
		String ans = flg ? "Yes" : "No";
		System.out.println(ans);
	}
}
