import java.util.*;
import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ren = 0;
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        }
        if(ren != 3) out.println("No");
    }
} import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ren = 0;
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        }
        if(ren != 3) out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ren = 0;
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        }
        if(ren != 3) out.println("No");
    } main {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ren = 0;
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        }
        if(ren != 3) out.println("No");
    } Scanner sc = new Scanner(in); sc new Scanner(in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ren = 0; ren 0 for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        } {
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if(a == b) ren++;
            else ren = 0; a == b a b ren++ ren ren = 0 ren 0 if(ren == 3){
                out.println("Yes");
                break;
            } ren == 3 ren 3 {
                out.println("Yes");
                break;
            } out.println("Yes") out.println out "Yes" break; if(ren != 3) out.println("No"); ren != 3 ren 3 out.println("No") out.println out "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ren = 0;
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        }
        if(ren != 3) out.println("No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ren = 0;
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        }
        if(ren != 3) out.println("No");
    }
} Main
import java.util.*;
import static java.lang.System.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);
        int n = sc.nextInt();
        int ren = 0;
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();

            if(a == b) ren++;
            else ren = 0;

            if(ren == 3){
                out.println("Yes");
                break;
            }
        }
        if(ren != 3) out.println("No");
    }
}
