import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		sc.close();

		boolean flag = false;
		int ans = 0;
		for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");



	}
} 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();

		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		sc.close();

		boolean flag = false;
		int ans = 0;
		for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");



	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		sc.close();

		boolean flag = false;
		int ans = 0;
		for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");



	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		sc.close();

		boolean flag = false;
		int ans = 0;
		for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");



	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array1 = new int[n]; array1 new int[n] n int[] array2 = new int[n]; array2 new int[n] n for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		} {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		} array1[i] = sc.nextInt() array1[i] array1 i sc.nextInt() sc.nextInt sc array2[i] = sc.nextInt() array2[i] array2 i sc.nextInt() sc.nextInt sc sc.close() sc.close sc boolean flag = false; flag false int ans = 0; ans 0 for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		} {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		} int d1 = array1[i]; d1 array1[i] array1 i int d2 = array2[i]; d2 array2[i] array2 i if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			} d1==d2 d1 d2 {
				flag = true;
				ans = ans + 1;
			} flag = true flag true ans = ans + 1 ans ans + 1 ans 1 {
				flag = false;
				ans = 0;
			} flag = false flag false ans = 0 ans 0 if(ans==3) {
				System.out.println("Yes");
				return;
			} ans==3 ans 3 {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		sc.close();

		boolean flag = false;
		int ans = 0;
		for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");



	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		sc.close();

		boolean flag = false;
		int ans = 0;
		for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");



	}
} 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();

		int[] array1 = new int[n];
		int[] array2 = new int[n];
		for(int i=0;i<n;i++) {
			array1[i] = sc.nextInt();
			array2[i] = sc.nextInt();
		}
		sc.close();

		boolean flag = false;
		int ans = 0;
		for(int i=0;i<n;i++) {
			int d1 = array1[i];
			int d2 = array2[i];
			if(d1==d2) {
				flag = true;
				ans = ans + 1;
			}else {
				flag = false;
				ans = 0;
			}

			if(ans==3) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");



	}
}
