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 < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		}

		for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		}

		System.out.print("No");
	}

} 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 < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		}

		for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		}

		System.out.print("No");
	}

} 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 < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		}

		for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		}

		System.out.print("No");
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] D = new int[N][2];

		for (int i = 0; i < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		}

		for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		}

		System.out.print("No");
	} 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 < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < D.length i D.length D D.length i++ i++ i {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		} {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		} D[i][0] = sc.nextInt() D[i][0] D[i] D i 0 sc.nextInt() sc.nextInt sc D[i][1] = sc.nextInt() D[i][1] D[i] D i 1 sc.nextInt() sc.nextInt sc for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < D.length - 2 i D.length - 2 D.length D D.length 2 i++ i++ i {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		} {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		} if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			} D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1] D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1] D[i][0] == D[i][1] D[i][0] D[i] D i 0 D[i][1] D[i] D i 1 D[i + 1][0] == D[i + 1][1] D[i + 1][0] D[i + 1] D i + 1 i 1 0 D[i + 1][1] D[i + 1] D i + 1 i 1 1 D[i + 2][0] == D[i + 2][1] D[i + 2][0] D[i + 2] D i + 2 i 2 0 D[i + 2][1] D[i + 2] D i + 2 i 2 1 {
				System.out.print("Yes");
				return;
			} System.out.print("Yes") System.out.print System.out System System.out "Yes" return; System.out.print("No") System.out.print 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 N = sc.nextInt();
		int[][] D = new int[N][2];

		for (int i = 0; i < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		}

		for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		}

		System.out.print("No");
	}

} 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 < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		}

		for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		}

		System.out.print("No");
	}

} 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 < D.length; i++) {
			D[i][0] = sc.nextInt();
			D[i][1] = sc.nextInt();
		}

		for (int i = 0; i < D.length - 2; i++) {
			if (D[i][0] == D[i][1] && D[i + 1][0] == D[i + 1][1] && D[i + 2][0] == D[i + 2][1]) {
				System.out.print("Yes");
				return;
			}
		}

		System.out.print("No");
	}

}