import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int count=0;
		boolean flag=false;
		for (int i=0;i<n;i++){
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int count=0;
		boolean flag=false;
		for (int i=0;i<n;i++){
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int count=0;
		boolean flag=false;
		for (int i=0;i<n;i++){
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	} main {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int count=0;
		boolean flag=false;
		for (int i=0;i<n;i++){
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n=in.nextInt(); n in.nextInt() in.nextInt in int count=0; count 0 boolean flag=false; flag false for (int i=0;i<n;i++){
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		} {
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		} int a=in.nextInt(); a in.nextInt() in.nextInt in int b=in.nextInt(); b in.nextInt() in.nextInt in if (a==b) count ++;
			else count =0; a==b a b count ++ count count =0 count 0 if (count>=3) flag=true; count>=3 count 3 flag=true flag true if (flag) System.out.println("Yes");
		else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int count=0;
		boolean flag=false;
		for (int i=0;i<n;i++){
			int a=in.nextInt();
			int b=in.nextInt();
			if (a==b) count ++;
			else count =0;
			if (count>=3) flag=true;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	}
}