import java.util.Scanner;

public class Main {

	static long mod = 1000000007;

	public static void main(String[] args) {
		// AtCoder_B
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int zoro = 0;
		String ans = "No";

		for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		}

		System.out.println(ans);

	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	static long mod = 1000000007;

	public static void main(String[] args) {
		// AtCoder_B
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int zoro = 0;
		String ans = "No";

		for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		}

		System.out.println(ans);

	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	}
} Main static long mod = 1000000007; mod 1000000007 public static void main(String[] args) {
		// AtCoder_B
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int zoro = 0;
		String ans = "No";

		for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		}

		System.out.println(ans);

	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	} main {
		// AtCoder_B
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int zoro = 0;
		String ans = "No";

		for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		}

		System.out.println(ans);

	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int zoro = 0; zoro 0 String ans = "No"; ans "No" for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		} {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		} if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			} sc.nextInt() == sc.nextInt() sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} zoro++ zoro if(zoro == 3) {
					ans = "Yes";
				} zoro == 3 zoro 3 {
					ans = "Yes";
				} ans = "Yes" ans "Yes" {
				zoro = 0;
			} zoro = 0 zoro 0 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {

	static long mod = 1000000007;

	public static void main(String[] args) {
		// AtCoder_B
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int zoro = 0;
		String ans = "No";

		for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		}

		System.out.println(ans);

	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	}
} public class Main {

	static long mod = 1000000007;

	public static void main(String[] args) {
		// AtCoder_B
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int zoro = 0;
		String ans = "No";

		for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		}

		System.out.println(ans);

	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	static long mod = 1000000007;

	public static void main(String[] args) {
		// AtCoder_B
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int zoro = 0;
		String ans = "No";

		for(int i=0; i<N; i++) {
			if(sc.nextInt() == sc.nextInt()) {
				zoro++;
				if(zoro == 3) {
					ans = "Yes";
				}
			} else {
				zoro = 0;
			}
		}

		System.out.println(ans);

	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	}
}
