import java.util.*;

public class Main{ //クラス名はMain
    public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    }
}
 import java.util.*; util.* java public class Main{ //クラス名はMain
    public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    }
} Main public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    } main {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int[] numbers = new int[num*2]; numbers new int[num*2] num*2 num 2 for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            } int i=0; int i=0; i 0 i<num*2 i num*2 num 2 i++ i++ i {
              	numbers[i] =sc.nextInt();
            } {
              	numbers[i] =sc.nextInt();
            } numbers[i] =sc.nextInt() numbers[i] numbers i sc.nextInt() sc.nextInt sc String ans = "No"; ans "No" int p = 0; p 0 int count = 0; count 0 for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            } int i=0; int i=0; i 0 i<num i num i++ i++ i {
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            } {
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            } if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              } numbers[p] == numbers[p+1] numbers[p] numbers p numbers[p+1] numbers p+1 p 1 {
                count++;
              } count++ count {
                count =0;
              } count =0 count 0 if(count == 3){
                ans ="Yes";
                break;
              } count == 3 count 3 {
                ans ="Yes";
                break;
              } ans ="Yes" ans "Yes" break; p+=2 p 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{ //クラス名はMain
    public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    }
} public class Main{ //クラス名はMain
    public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    }
} Main
import java.util.*;

public class Main{ //クラス名はMain
    public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    }
}

