import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] d = new int[n][2];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		}
		int num = 0;
		boolean cont = false;
		for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		}
		if(num<3)cont=false;
		System.out.println(cont? "Yes":"No");
	}
} import java.util.*; util.* java import java.math.RoundingMode; RoundingMode java.math import java.math.BigDecimal; BigDecimal java.math public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] d = new int[n][2];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		}
		int num = 0;
		boolean cont = false;
		for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		}
		if(num<3)cont=false;
		System.out.println(cont? "Yes":"No");
	}
} Main public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] d = new int[n][2];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		}
		int num = 0;
		boolean cont = false;
		for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		}
		if(num<3)cont=false;
		System.out.println(cont? "Yes":"No");
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] d = new int[n][2];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		}
		int num = 0;
		boolean cont = false;
		for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		}
		if(num<3)cont=false;
		System.out.println(cont? "Yes":"No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[][] d = new int[n][2]; d new int[n][2] n 2 for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		} {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		} for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			} int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
				d[i][j] = sc.nextInt();
			} {
				d[i][j] = sc.nextInt();
			} d[i][j] = sc.nextInt() d[i][j] d[i] d i j sc.nextInt() sc.nextInt sc int num = 0; num 0 boolean cont = false; cont false for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		} {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		} if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			} d[i][0]==d[i][1] d[i][0] d[i] d i 0 d[i][1] d[i] d i 1 {
				cont = true;
				num++;
			} cont = true cont true num++ num {
				cont = false;
				num=0;
			} cont = false cont false num=0 num 0 if(num>=3) break; num>=3 num 3 break; if(num<3)cont=false; num<3 num 3 cont=false cont false System.out.println(cont? "Yes":"No") System.out.println System.out System System.out cont? "Yes":"No" cont "Yes" "No" String[] args args public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] d = new int[n][2];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		}
		int num = 0;
		boolean cont = false;
		for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		}
		if(num<3)cont=false;
		System.out.println(cont? "Yes":"No");
	}
} public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] d = new int[n][2];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		}
		int num = 0;
		boolean cont = false;
		for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		}
		if(num<3)cont=false;
		System.out.println(cont? "Yes":"No");
	}
} Main
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] d = new int[n][2];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 2; j++) {
				d[i][j] = sc.nextInt();
			}
		}
		int num = 0;
		boolean cont = false;
		for(int i = 0; i < n; i++) {
			if(d[i][0]==d[i][1]) {
				cont = true;
				num++;
			}
			else{
				cont = false;
				num=0;
			}
			if(num>=3) break;
		}
		if(num<3)cont=false;
		System.out.println(cont? "Yes":"No");
	}
}