import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        int count = 0;
        String ans = "No";
        for(int i=0;i<N;i++){
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        int count = 0;
        String ans = "No";
        for(int i=0;i<N;i++){
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        int count = 0;
        String ans = "No";
        for(int i=0;i<N;i++){
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        int count = 0;
        String ans = "No";
        for(int i=0;i<N;i++){
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] d1 = new int[N]; d1 new int[N] N int[] d2 = new int[N]; d2 new int[N] N int count = 0; count 0 String ans = "No"; ans "No" for(int i=0;i<N;i++){
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        } {
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        } d1[i] = sc.nextInt() d1[i] d1 i sc.nextInt() sc.nextInt sc d2[i] = sc.nextInt() d2[i] d2 i sc.nextInt() sc.nextInt sc if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            } d1[i] == d2[i] d1[i] d1 i d2[i] d2 i {
                count++;
            } count++ count {
                count = 0;
            } count = 0 count 0 if(count == 3){
                ans = "Yes";
                break;
            } count == 3 count 3 {
                ans = "Yes";
                break;
            } ans = "Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        int count = 0;
        String ans = "No";
        for(int i=0;i<N;i++){
            d1[i] = sc.nextInt();
            d2[i] = sc.nextInt();
            if(d1[i] == d2[i]){
                count++;
            }else{
                count = 0;
            }
            if(count == 3){
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
}
