import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int z = 0;
		ArrayList<Integer> d1 = new ArrayList<>();
		ArrayList<Integer> d2 = new ArrayList<>();

		for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		}
		for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		}

		if(z==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	}

} import java.util.ArrayList; ArrayList java.util 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 z = 0;
		ArrayList<Integer> d1 = new ArrayList<>();
		ArrayList<Integer> d2 = new ArrayList<>();

		for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		}
		for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		}

		if(z==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int z = 0;
		ArrayList<Integer> d1 = new ArrayList<>();
		ArrayList<Integer> d2 = new ArrayList<>();

		for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		}
		for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		}

		if(z==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int z = 0;
		ArrayList<Integer> d1 = new ArrayList<>();
		ArrayList<Integer> d2 = new ArrayList<>();

		for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		}
		for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		}

		if(z==3) {
			System.out.println("Yes");
		}else {
			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 z = 0; z 0 ArrayList<Integer> d1 = new ArrayList<>(); d1 new ArrayList<>() ArrayList<Integer> d2 = new ArrayList<>(); d2 new ArrayList<>() for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		} int i=0; int i=0; i 0 i<n i n i++ i++ i {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		} {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		} d1.add(sc.nextInt()) d1.add d1 sc.nextInt() sc.nextInt sc d2.add(sc.nextInt()) d2.add d2 sc.nextInt() sc.nextInt sc for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		} int i=0; int i=0; i 0 i<n i n i++ i++ i {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		} {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		} if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			} d1.get(i)==d2.get(i) d1.get(i) d1.get d1 i d2.get(i) d2.get d2 i {
				z++;
			} z++ z {
				z=0;
			} z=0 z 0 if(z==3) {
				break;
			} z==3 z 3 {
				break;
			} break; if(z==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} z==3 z 3 {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} 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 n = sc.nextInt();
		int z = 0;
		ArrayList<Integer> d1 = new ArrayList<>();
		ArrayList<Integer> d2 = new ArrayList<>();

		for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		}
		for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		}

		if(z==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int z = 0;
		ArrayList<Integer> d1 = new ArrayList<>();
		ArrayList<Integer> d2 = new ArrayList<>();

		for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		}
		for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		}

		if(z==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	}

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int z = 0;
		ArrayList<Integer> d1 = new ArrayList<>();
		ArrayList<Integer> d2 = new ArrayList<>();

		for(int i=0;i<n;i++) {

			d1.add(sc.nextInt());
			d2.add(sc.nextInt());

		}
		for(int i=0;i<n;i++) {

			if(d1.get(i)==d2.get(i)) {
				z++;
			}else {
				z=0;
			}

			if(z==3) {
				break;
			}

		}

		if(z==3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}


	}

}