import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n+1];
		boolean status=false;
		for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		}
		System.out.println(status?"Yes":"No");
		sc.close();
	}

} 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[] a = new int[n+1];
		int[] b = new int[n+1];
		boolean status=false;
		for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		}
		System.out.println(status?"Yes":"No");
		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n+1];
		boolean status=false;
		for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		}
		System.out.println(status?"Yes":"No");
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n+1];
		boolean status=false;
		for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		}
		System.out.println(status?"Yes":"No");
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n+1]; a new int[n+1] n+1 n 1 int[] b = new int[n+1]; b new int[n+1] n+1 n 1 boolean status=false; status false for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		} int i=1; int i=1; i 1 i<=n i n i++ i++ i {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		} {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		} a[i]=sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc b[i]=sc.nextInt() b[i] b i sc.nextInt() sc.nextInt sc for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		} int i=1; int i=1; i 1 i<=n-2 i n-2 n 2 i++ i++ i {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		} {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		} if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			} a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2] a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2] a[i]==b[i] a[i] a i b[i] b i a[i+1]==b[i+1] a[i+1] a i+1 i 1 b[i+1] b i+1 i 1 a[i+2]==b[i+2] a[i+2] a i+2 i 2 b[i+2] b i+2 i 2 {
				status=true;
				break;
			} status=true status true break; System.out.println(status?"Yes":"No") System.out.println System.out System System.out status?"Yes":"No" status "Yes" "No" sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n+1];
		boolean status=false;
		for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		}
		System.out.println(status?"Yes":"No");
		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n+1];
		boolean status=false;
		for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		}
		System.out.println(status?"Yes":"No");
		sc.close();
	}

} 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[] a = new int[n+1];
		int[] b = new int[n+1];
		boolean status=false;
		for(int i=1;i<=n;i++) {
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		for(int i=1;i<=n-2;i++) {
			if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]) {
				status=true;
				break;
			}
		}
		System.out.println(status?"Yes":"No");
		sc.close();
	}

}