import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();

		int[] D = new int[2 * N];

		for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		}
		String ans = "No";

		for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		}

		//結果出力
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();

		int[] D = new int[2 * N];

		for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		}
		String ans = "No";

		for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		}

		//結果出力
		System.out.println(ans);
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();

		int[] D = new int[2 * N];

		for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		}
		String ans = "No";

		for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		}

		//結果出力
		System.out.println(ans);
	} main {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();

		int[] D = new int[2 * N];

		for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		}
		String ans = "No";

		for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		}

		//結果出力
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[] D = new int[2 * N]; D new int[2 * N] 2 * N 2 N for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < 2 * N i 2 * N 2 N i += 2 i += 2 i 2 {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		} {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		} D[i] = scan.nextInt() D[i] D i scan.nextInt() scan.nextInt scan D[i + 1] = scan.nextInt() D[i + 1] D i + 1 i 1 scan.nextInt() scan.nextInt scan String ans = "No"; ans "No" for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		} int i = 0; int i = 0; i 0 i < 2 * (N - 2) i 2 * (N - 2) 2 (N - 2) N 2 i += 2 i += 2 i 2 {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		} {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		} if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			} D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5] D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5] D[i] == D[i + 1] D[i] D i D[i + 1] D i + 1 i 1 D[i + 2] == D[i + 3] D[i + 2] D i + 2 i 2 D[i + 3] D i + 3 i 3 D[i + 4] == D[i + 5] D[i + 4] D i + 4 i 4 D[i + 5] D i + 5 i 5 {
				ans = "Yes";
			} ans = "Yes" ans "Yes" 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) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();

		int[] D = new int[2 * N];

		for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		}
		String ans = "No";

		for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		}

		//結果出力
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();

		int[] D = new int[2 * N];

		for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		}
		String ans = "No";

		for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		}

		//結果出力
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		//入力値取得
		int N = scan.nextInt();

		int[] D = new int[2 * N];

		for (int i = 0; i < 2 * N; i += 2) {
			D[i] = scan.nextInt();
			D[i + 1] = scan.nextInt();
		}
		String ans = "No";

		for (int i = 0; i < 2 * (N - 2); i += 2) {
			if (D[i] == D[i + 1] && D[i + 2] == D[i + 3] && D[i + 4] == D[i + 5]) {
				ans = "Yes";
			}
		}

		//結果出力
		System.out.println(ans);
	}
}