import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] d = new int[N][2];
        for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        }

        for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                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[][] d = new int[N][2];
        for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        }

        for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                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[][] d = new int[N][2];
        for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        }

        for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");        
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] d = new int[N][2];
        for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        }

        for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                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[][] d = new int[N][2]; d new int[N][2] N 2 for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        } int n=0; int n=0; n 0 n<N n N n++ n++ n {
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        } {
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        } d[n][0] = sc.nextInt() d[n][0] d[n] d n 0 sc.nextInt() sc.nextInt sc d[n][1] = sc.nextInt() d[n][1] d[n] d n 1 sc.nextInt() sc.nextInt sc for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                System.out.println("Yes");
                return;
            }
        } int n=0; int n=0; n 0 n<N-2 n N-2 N 2 n++ n++ n {
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                System.out.println("Yes");
                return;
            }
        } {
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                System.out.println("Yes");
                return;
            }
        } if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                System.out.println("Yes");
                return;
            } d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1] d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1] d[n][0]==d[n][1] d[n][0] d[n] d n 0 d[n][1] d[n] d n 1 d[n+1][0]==d[n+1][1] d[n+1][0] d[n+1] d n+1 n 1 0 d[n+1][1] d[n+1] d n+1 n 1 1 d[n+2][0]==d[n+2][1] d[n+2][0] d[n+2] d n+2 n 2 0 d[n+2][1] d[n+2] d n+2 n 2 1 {
                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[][] d = new int[N][2];
        for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        }

        for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                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[][] d = new int[N][2];
        for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        }

        for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                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[][] d = new int[N][2];
        for(int n=0; n<N; n++){
            d[n][0] = sc.nextInt();
            d[n][1] = sc.nextInt();
        }

        for(int n=0; n<N-2; n++){
            if(d[n][0]==d[n][1] && d[n+1][0]==d[n+1][1] && d[n+2][0]==d[n+2][1]){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");        
    }
}