import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        int[] A = new int[N];
        int[] B = new int[N];
        int count=0;
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        }
        

        
        System.out.println("No");
        }
    } import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        int[] A = new int[N];
        int[] B = new int[N];
        int count=0;
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        }
        

        
        System.out.println("No");
        }
    } Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        int[] A = new int[N];
        int[] B = new int[N];
        int count=0;
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        }
        

        
        System.out.println("No");
        } main {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        int[] A = new int[N];
        int[] B = new int[N];
        int count=0;
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        }
        

        
        System.out.println("No");
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A = new int[N]; A new int[N] N int[] B = new int[N]; B new int[N] N int count=0; count 0 for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        } {
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        } A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc B[i]=sc.nextInt() B[i] B i sc.nextInt() sc.nextInt sc if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            } A[i]==B[i] A[i] A i B[i] B i {
                count++;
            } count++ count {
                count=0;
            } count=0 count 0 if(count==3){
                System.out.println("Yes");
                return;
            } count==3 count 3 {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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 sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        int[] A = new int[N];
        int[] B = new int[N];
        int count=0;
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        }
        

        
        System.out.println("No");
        }
    } public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        int[] A = new int[N];
        int[] B = new int[N];
        int count=0;
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        }
        

        
        System.out.println("No");
        }
    } Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        int[] A = new int[N];
        int[] B = new int[N];
        int count=0;
        for(int i=0; i<N; i++){
            A[i]=sc.nextInt();
            B[i]=sc.nextInt();
            if(A[i]==B[i]){
                count++;
            }else{
                count=0;
            }
            if(count==3){
                System.out.println("Yes");
                return;
            }
        }
        

        
        System.out.println("No");
        }
    }