import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int a[][] = new int[N][2];
        for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        String ans = "No";

        for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        sc.close();
    }
} 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 a[][] = new int[N][2];
        for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        String ans = "No";

        for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int a[][] = new int[N][2];
        for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        String ans = "No";

        for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int a[][] = new int[N][2];
        for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        String ans = "No";

        for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        sc.close();
    } 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][2]; a new int[N][2] N 2 for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        } {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        } a[i][0] = sc.nextInt() a[i][0] a[i] a i 0 sc.nextInt() sc.nextInt sc a[i][1] = sc.nextInt() a[i][1] a[i] a i 1 sc.nextInt() sc.nextInt sc String ans = "No"; ans "No" for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        } int i = 0; int i = 0; i 0 i < N - 2 i N - 2 N 2 i++ i++ i {
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        } {
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        } if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            } a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1] a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1] a[i][0] == a[i][1] a[i][0] a[i] a i 0 a[i][1] a[i] a i 1 a[i+1][0] == a[i+1][1] a[i+1][0] a[i+1] a i+1 i 1 0 a[i+1][1] a[i+1] a i+1 i 1 1 a[i+2][0] == a[i+2][1] a[i+2][0] a[i+2] a i+2 i 2 0 a[i+2][1] a[i+2] a i+2 i 2 1 {
                ans = "Yes";
                break;
            } ans = "Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int a[][] = new int[N][2];
        for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        String ans = "No";

        for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int a[][] = new int[N][2];
        for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        String ans = "No";

        for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        sc.close();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int a[][] = new int[N][2];
        for(int i = 0; i < N; i++){
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }

        String ans = "No";

        for(int i = 0; i < N - 2; i++){
            if(a[i][0] == a[i][1] && a[i+1][0] == a[i+1][1] && a[i+2][0] == a[i+2][1]){
                ans = "Yes";
                break;
            }
        }

        System.out.println(ans);

        sc.close();
    }
}