import java.util.Arrays;
import java.util.Collections;
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 k=0;
	for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){System.out.println("Yes");System.exit(0);}
	}
		System.out.println("No");
	}
} import java.util.Arrays; Arrays java.util import java.util.Collections; Collections 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 k=0;
	for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){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 k=0;
	for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){System.out.println("Yes");System.exit(0);}
	}
		System.out.println("No");
	} main {
		Scanner ob=new Scanner(System.in);
	int n=ob.nextInt();
	int k=0;
	for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){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 k=0; k 0 for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){System.out.println("Yes");System.exit(0);}
	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){System.out.println("Yes");System.exit(0);}
	} {
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){System.out.println("Yes");System.exit(0);}
	} int a=ob.nextInt(); a ob.nextInt() ob.nextInt ob int b=ob.nextInt(); b ob.nextInt() ob.nextInt ob if(a==b){k++;}
	else{k=0;} a==b a b {k++;} k++ k {k=0;} k=0 k 0 if(k==3){System.out.println("Yes");System.exit(0);} k==3 k 3 {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 k=0;
	for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){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 k=0;
	for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){System.out.println("Yes");System.exit(0);}
	}
		System.out.println("No");
	}
} Main
import java.util.Arrays;
import java.util.Collections;
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 k=0;
	for(int i=0;i<n;i++)
	{
	int a=ob.nextInt();
	int b=ob.nextInt();
	if(a==b){k++;}
	else{k=0;}
	if(k==3){System.out.println("Yes");System.exit(0);}
	}
		System.out.println("No");
	}
}