import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        int max = 0;
        for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count>max){
            max = count;
        }
        System.out.println(max>=3?"Yes":"No");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        int max = 0;
        for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count>max){
            max = count;
        }
        System.out.println(max>=3?"Yes":"No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        int max = 0;
        for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count>max){
            max = count;
        }
        System.out.println(max>=3?"Yes":"No");
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        int max = 0;
        for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count>max){
            max = count;
        }
        System.out.println(max>=3?"Yes":"No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int count = 0; count 0 int max = 0; max 0 for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        } {
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        } if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            } sc.nextInt()==sc.nextInt() sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc {
                count++;
            } count++ count {
                if(count>max){
                    max = count;
                }
                count = 0;
            } if(count>max){
                    max = count;
                } count>max count max {
                    max = count;
                } max = count max count count = 0 count 0 if(count>max){
            max = count;
        } count>max count max {
            max = count;
        } max = count max count System.out.println(max>=3?"Yes":"No") System.out.println System.out System System.out max>=3?"Yes":"No" max>=3 max 3 "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 count = 0;
        int max = 0;
        for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count>max){
            max = count;
        }
        System.out.println(max>=3?"Yes":"No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        int max = 0;
        for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count>max){
            max = count;
        }
        System.out.println(max>=3?"Yes":"No");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        int max = 0;
        for(int i=0;i<N;i++){
            if(sc.nextInt()==sc.nextInt()){
                count++;
            }else{
                if(count>max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count>max){
            max = count;
        }
        System.out.println(max>=3?"Yes":"No");
    }
}