import java.util.Arrays;
import java.util.Scanner;
import java.util.Vector;
public class Main {

	public static void main(String[] args) {
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		}
		for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		}
		System.out.println("No");
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util import java.util.Vector; Vector java.util public class Main {

	public static void main(String[] args) {
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		}
		for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		}
		System.out.println("No");
	}
} Main public static void main(String[] args) {
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		}
		for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		}
		System.out.println("No");
	} main {
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		}
		for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		}
		System.out.println("No");
	} Scanner ob=new Scanner(System.in); ob new Scanner(System.in) int n=ob.nextInt(); n ob.nextInt() ob.nextInt ob int a[]=new int[n]; a new int[n] n int b[]=new int[n]; b new int[n] n for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		} {
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		} int x=ob.nextInt(); x ob.nextInt() ob.nextInt ob int y=ob.nextInt(); y ob.nextInt() ob.nextInt ob a[i]=x a[i] a i x b[i]=y b[i] b i y for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		} int i=0; int i=0; i 0 i<=a.length-3 i a.length-3 a.length a a.length 3 i++ i++ i {
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		} {
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		} if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		} 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 {
			System.out.println("Yes");
			System.exit(0);
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 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 ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		}
		for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		}
		System.out.println("No");
	}
} public class Main {

	public static void main(String[] args) {
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		}
		for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		}
		System.out.println("No");
	}
} Main
import java.util.Arrays;
import java.util.Scanner;
import java.util.Vector;
public class Main {

	public static void main(String[] args) {
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		int b[]=new int[n];
		for(int i=0;i<n;i++)
		{
		int x=ob.nextInt();
		int y=ob.nextInt();
		a[i]=x;b[i]=y;
		}
		for(int i=0;i<=a.length-3;i++)
		{
		if(a[i]==b[i]&&a[i+1]==b[i+1]&&a[i+2]==b[i+2]){
			System.out.println("Yes");
			System.exit(0);
		}
		}
		System.out.println("No");
	}
}