import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int[] n = new int[number];
		int[] m = new int[number];

		for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 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) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int[] n = new int[number];
		int[] m = new int[number];

		for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

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

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int[] n = new int[number];
		int[] m = new int[number];

		for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

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

	} main {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int[] n = new int[number];
		int[] m = new int[number];

		for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

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

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int number = sc.nextInt(); number sc.nextInt() sc.nextInt sc int[] n = new int[number]; n new int[number] number int[] m = new int[number]; m new int[number] number for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < number i number i++ i++ i {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		} {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		} n[i] = sc.nextInt() n[i] n i sc.nextInt() sc.nextInt sc m[i] = sc.nextInt() m[i] m i sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

		} int i = 0; int i = 0; i 0 i < number i number i++ i++ i {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

		} {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

		} if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			} n[i] == m[i] n[i] n i m[i] m i {
				cnt++;
			} cnt++ cnt if(n[i] != m[i]) {
				cnt = 0;
			} n[i] != m[i] n[i] n i m[i] m i {
				cnt = 0;
			} cnt = 0 cnt 0 if (cnt == 3) {
				System.out.println("Yes");
				return;
			} cnt == 3 cnt 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) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int[] n = new int[number];
		int[] m = new int[number];

		for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

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

	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int[] n = new int[number];
		int[] m = new int[number];

		for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

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

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int[] n = new int[number];
		int[] m = new int[number];

		for (int i = 0; i < number; i++) {
			n[i] = sc.nextInt();
			m[i] = sc.nextInt();
		}
		int cnt = 0;
		for (int i = 0; i < number; i++) {
			if (n[i] == m[i]) {
				cnt++;
			}else if(n[i] != m[i]) {
				cnt = 0;
			}
			if (cnt == 3) {
				System.out.println("Yes");
				return;
			}

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

	}
}
